DEV Community

Cover image for Fix: SVG Colors not working properly
Visakh Vijayan
Visakh Vijayan

Posted on • Edited on

1 1

Fix: SVG Colors not working properly

We were trying to change the color of an svg. But our initial images were not of the same color. After a while we figured out the best way would be to force them to an initial color and then do filtering.

Here is how our plain svgs looked
Plain SVGs

Here is our code

<img 
src={item.icon} 
style=
{{ 
    height: "100%", 
    width: "auto", 
    borderRadius: "10px", 
    display: "block", 
    filter: "brightness(0) saturate(100%) invert(31%) sepia(82%) saturate(6098%) hue-rotate(256deg) brightness(93%)" 

}} />
Enter fullscreen mode Exit fullscreen mode

The brightness(0) and saturate(100%) turn the image to black.

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay