Open jonahwilliams opened 2 years ago
I think part of this would be needing to make currentColor
work.
Do you have some examples of what you'd like to support?
And is this runtime
or compiletime
support?
Does currentColor work with more than one color? It would have to be runtime support, but implemented so that the compiler didn't optimize these colors out
No, currentColor is just one color and a hard coded string in the doc.
Every time I've come up against this problem it hasn't been clear to me how to do it in an abstract way short of just offering color filtering. I vaguely remember considering some kind of Map<Color, Color>
solution, but also being worried it'd get hard to reason about when tranparency/gradients/overlapping colors get involved.
Yeah, if you have a dynamic color you basically can't do any optimizations/folding with it. I think that could still work, but we'd also still need a way to declare it, and I wonder if we could just steal use css classes or ids?
It'd help to have some examples of what the internal customers are currently doing and what they expect to achieve.
I've spoken to several client teams that use some combination of SVG parsing and the SVG theme API to provide dynamic colors to an SVG. We should support a compile time option for this, perhaps accepting a map of identifier -> color in the VectorGraphic constructor.
TBD: how should we indicate dynamic color in the SVG?