DEV Community

Discussion on: Customizing SVG Icon Color with React Component Using CSS Filter

Collapse
 
feerzlay profile image
Denis Yakshov

In our projects we replace stroke and fill values with currentColor. This way we can change icon color with just one line of css.

Collapse
 
asucarlos profile image
Aska

Thanks for your reply Denis! Yes, I think for simple icons, your approach would be a better one. The reason why I tried this way was that I found for some icons that are more complex and mixing fill/stroke color (e.g. "#000", "rgba(0,0,0,0.5)" or "none"), that approach modified unwanted values. If you ever need to tackle these cases, this approach would work without problems and can be set verbose.