CHANGE COLOR SVG
hi guys plz how can i change the color of an image with svg type????
9 Replies
The fill attribute
You can't override the fill though, I'm a big fan of using custom props with a currentColor fallback https://codepen.io/b1mind/pen/vYpvzbo
you could ofc take out the fill/stroke attributes too and then use css fill/stroke and it would work.
or use
var(--prop, red)
it with a set color and custom prop override vs currentColorI prefer using just
currentColor
for svg icons because it makes it easier to sync icon color with its label text and I don't need to declare the color for both the text and the iconcan you tell me what is stroke
yeak tanks it works
good stuff!
https://gomakethings.com/currentcolor-and-svgs/ good article too
currentColor and SVGs
Yesterday, we looked at how to use the currentColor property to build extensible components.
I got a lot of emails mentioning how awesome this CSS property is with SVGs, too. Let’s dig in.
SVGs and fill color So, let’s say you’ve got an SVG icon that you want to color match to the rest of the text. For example, here’s an SVG of a tree ().
Ferdinandi is awesome
this dude is amazing bro