w3c / svgwg

SVG Working Group specifications
Other
708 stars 133 forks source link

[svg-native] Consider supporting CSS Variables #668

Open litherum opened 5 years ago

litherum commented 5 years ago

OpenType fonts use CSS Variables to represent palette colors. We should decide if SVG Native should support CSS Variables, or should that support be described in the OpenType spec. If we do support CSS Variables, we'll have to be very specific about whether we support creating them or just using them, and which attributes / places in the grammar accept them.

litherum commented 5 years ago

@dirkschulze says:

IMO var() is essential for SVG Native. That allows theming support that we need in SVG OT and applications! But we should add restirctions:

  • Only on the fill, stroke, stop-color, color properties.
  • Only valid Color values excluding new color values introduced with CSS3 Colors or later. So restricted to: color keywords (but system colors), HEX strings (with 3 or 6 values), rgb() and (possibly) var().
litherum commented 5 years ago

Nested var()

litherum commented 5 years ago

@jarek-foksa says:

Yeah, I think it's worth checking which features are supported by Android's VectorDrawable file format as it had very similar design goals (security, performance, ubiquity). VectorDrawable does support basic theming and even animations (which are used extensively by modern native UIs).

dirkschulze commented 5 years ago

As a side note, this does align with the use case of native application icons as well. Theming or dark/light mode have an effect on how icons get displayed. Beside of the mentioned VectorDrawable format, XAML has themed colors as well.

dirkschulze commented 5 years ago

In the last call we decided that we'd remove style attribute support (and any means to specify a custom property) but do allow var() on all presentation attributes.

Meeting minutes