CHANGE COLOR SVG

hi guys plz how can i change the color of an image with svg type????
9 Replies
vince
vince2y ago
The fill attribute
b1mind
b1mind2y ago
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
b1mind
b1mind2y ago
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 currentColor
Rägnar O'ock
Rägnar O'ock2y ago
I 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 icon
BERSERK
BERSERKOP2y ago
can you tell me what is stroke yeak tanks it works
vince
vince2y ago
good stuff!
vince
vince2y ago
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 ().
b1mind
b1mind2y ago
Ferdinandi is awesome b1mindCool
BERSERK
BERSERKOP2y ago
this dude is amazing bro
Want results from more Discord servers?
Add your server