DEV Community

Changing Fill of SVG within an Image tag

Cedric W on March 05, 2019

Is there a way to change the fill of a `svg` within an `img src` outside of the svg itself? e.g. <img src="/images/logo.svg" alt="company l...
Collapse
 
briankephart profile image
Brian Kephart

I've done it using Tailwind CSS, and their docs show the relevant vanilla CSS properties: tailwindcss.com/docs/svg/#app

Collapse
 
horus_sky profile image
Cedric W

Brian, thanks for the quick feedback! But this is not exactly what I'm looking for because they are manipulating the svg inline. I think I may have to consider either adding the SVG inline, or using a different solution, like replacing the SVG with a PNG on the print stylesheet.

Collapse
 
briankephart profile image
Brian Kephart

D'oh! You're right, I forgot that I inlined the image when I did that. Sorry!