I am having trouble changing the color of a small png on the canvas in Fabric.js.
In my research, I found that I could use new fabric.Image.filters.Tint()
to modify the color of an image in the way that I was looking to. However, there is no Tint()
constructor in v2 of Fabric. According to this page, Tint()
is now part of the BlendColor()
filter. I have tried various things with BlendColor()
, but I have yet to get it to work. Any advice on how to use BlendColor()
or some other filter to accomplish what I want is much appreciated.
My best guess is to do something like this, but it doesn't work:
var filter = new fabric.Image.filters.BlendColor({
color: '#c9f364',
mode: 'multiply'
});
canvas.getObjects()[0].filters.push(filter);
canvas.getObjects()[0].applyFilters();
canvas.renderAll();