Re: [CSSWG] Resolutions 2008-03: Future Features

fantasai:
> Constants
> ---------
>
>   Clear use case for importing colors from a site-wide style sheet.
>   CSSWG wants more concrete use cases for anything beyond that.

I believe valid use cases are all those where values are dependent on  
each other. The values may be the same or arithmetically linked, they  
must be of the same type, but may be used in different properties and  
in different rulesets.

The most obvious and common example is indeed colors, because color  
themes are something everyone uses and the same color will be used  
for text, backgrounds and borders, so you can't just group selectors.

The same lengths or lengths formed by addition and substraction of  
other lengths are used frequently, too. One simple example is the  
width of one box that is to be put into the margin of another.

>   fantasai points to webstandards.org comments and suggests macros
>   for selectors, values, and declaration sets would fulfill most
>   requests there.

I'm not convinced constants should apply to more than values.

>   CSSWG will post a simple proposal macros for values only,

Good.

My proposal is to provide authors with a set of keywords whose values  
they can overwrite with an at-rule at the beginning of the stylesheet  
and only for this one (like charset and namespace). For colors I  
suggest these to be the SVG and (probably) HTML and maybe System  
keywords, but not |currentcolor| and |transparent|. For lengths I  
suggest new placeholder keywords: |xx-small-amount|, |x-small- 
amount|, |small-amount|, |medium-amount|, |large-amount|, |x-large- 
amount| and |xx-large-amount| ('amount' may be replaced by 'length');  
they should be usable inside 'calc()'. For font sizes I propose to  
use the keywords the ones above are based upon. For those, unlike for  
colors (unless limited to the ones from HTML), there could even be a  
shorthand property to set them. Percentages probably should not be  
supported.

Actually, with predefined constant names, it might be possible to  
allow a broader scope than the current stylesheet. I haven't thought  
about that yet.

Others have, of course, proposed to use a pseudo function to  
reference constants. This may or may not be 'calc()'.

Received on Thursday, 3 April 2008 09:29:05 UTC