Allow setting the default `currentColor`
Most web icons, including tailwindlabs/heroicons allows to set icon color with css font color on the page/block. This is done with stroke="currentColor" on the svg icon. For now resvg allows to set background color with --background COLOR argument, it would be really nice to have an option to do the same for "foreground" color. This way it would be possible to render icons for dark backgrounds.
What do you mean by "foreground" color? currentColor is background color.
It is possible to set icon color on web, here is an example:
<div style="color: red">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor">
<circle cx="12" cy="12" r="10" />
</svg>
</div>
But resvg --background white test.svg test.png will render black circle on white background, as there is no possibility now to set the icon color similar way as it is done on web.
I understand your point now and yes it's not possible right now.
We probably have to implement #277 first and then you can set color on the root element via CSS.
Unlike Web/HTML, in static SVG currentColor is resolved only inside the file itself.
And while we can add an ability to set the default currentColor, it would still be rather limited compared to CSS injection.
This is possible now, so I think we can close this issue.
You mean via CSS injection?
Yep.
I don't think that's a proper solution. More like a hack. And no one will figure it out unless we document it somewhere...