- From: Simon Sapin <simon.sapin@exyr.org>
- Date: Fri, 14 Mar 2014 11:13:03 +0000
- To: Christoph Päper <christoph.paeper@crissov.de>, www-style list <www-style@w3.org>
On 14/03/2014 10:29, Christoph Päper wrote: > This reminded me of an idea I had a while ago: turn color names into pseudo functions, e.g. ‘gray’: > > ‘gray0’ = gray(0%) /* = ‘black’ */ > … > ‘gray50’ = gray(50%) > … > ‘gray’ = gray() /* = ‘gray(50%)’ in CSS, but ‘gray75’ in X11 */ > … > ‘gray75’ = gray(75%) /* = ‘silver’ = ‘silver()’ */ > … > ‘gray100’ = gray(100%) /* = ‘white’ */ > > I think this notation has been suggested before as a shortcut for repeated triplets in RGB functions or as an alias to also proposed single-value RGB function or as the lightness in otherwise zeroed HSL (and HSV) values. > > ‘gray(<percent>)’ > = ‘rgb(<percent>, <percent>, <percent>)’ > = ‘rgb(<percent>)’ > = ‘hsl(0, 0%, <percent>)’ > > I would generalize the latter for all absolute color names of CSS2 (either level 2.0 or 2.1): > > <color-name-extended> := <level2-color-name> [ ‘(’ [<lightness>]? ‘)’ ]? > ^= hsl( hue(<level2-color-name>), saturation(<level2-color-name>), <lightness> ) > > Let’s not stop there. We could put basically anything inside those parentheses and it would work nicely even within shorthand properties. This includes CNS keywords! > > <color-name-extended> := <hue> [ ‘(’ <lightness> || <saturation> ‘)’ ]? > > <hue> := <level2-color-name> [‘-’ <level2-color-name>]? > > <lightness> := [<absolute>]? <lightness-value> > | <lightness-value> <relative> > | <percentage> | ‘medium’ > <saturation> := [<absolute>]? <saturation-value> > | <saturation-value> <relative> > | <percentage> | ‘medium’ > > <lightness-value> := ‘dark’ | ‘light’ > <saturation-value> := ‘dull’ | ‘bright’ > > <absolute> := [ ‘extra’ | ‘semi’ | ‘ultra’ | ‘very’ | ‘hardly’ ] ‘-’ > <relative> := [ ‘er’ | ‘est’ | ‘ish’ ] Level 4 of the Color module has some proposals along these lines: http://dev.w3.org/csswg/css-color/#grays http://dev.w3.org/csswg/css-color/#modifying-colors Feel free to give feedback on these here. -- Simon Sapin
Received on Friday, 14 March 2014 11:13:30 UTC