Answer the question
In order to leave comments, you need to log in
How to replace a specific color with another using the feColorMatrix filter?
How to replace a specific color with another using the feColorMatrix filter?
Answer the question
In order to leave comments, you need to log in
You can cheat something like this:
The idea is that just a filter with feColorMatrix will be applied to everything in general, you must first select an area with a specific color, replace it there and overlay it on the original image.
But it's important to understand that any such thing with partial overlays of the image on itself can run into problems with sizes of a non-integer number of pixels and artifacts of 1px will appear at the edges of the replaced color. Sometimes it doesn’t matter, the tasks are different, but if you need it to be beautiful and reliable, then it’s better to do it on the canvas (or even better - immediately in the WebGL context) - there you can go through all the pixels with your own hands and replace colors without overlaying layers. This will be a more convoluted solution given the need to convert the SVG to a canvas image, but its reliability cannot be surpassed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question