I want to use this technique and change the SVG color, but so far I haven't been able to do so. I use this in the CSS, but my image is always black, no matter what.
My code:
.change-my-color {
fill: green;
}
<svg>
<image class="change-my-color" xlink:href="https://svgur.com/i/AFM.svg" width="96" height="96" src="ppngfallback.png" />
</svg>
Best Answer
2020 answer
CSS Filter works on all current browsers
To change any SVGs color
Add the SVG image using an
<img>
tag.To filter to a specific color, use the following Codepen (click here to open the codepen) to convert a hexadecimal color code to a CSS filter:
For example, output for
#00EE00
isGenerate a
filter
for any color here.Add the CSS
filter
into this class.