W3C home > Mailing lists > Public > www-style@w3.org > December 2010

Re: [css4-color] @color-keyword Color Keywords

From: Christoph Päper <christoph.paeper@crissov.de>
Date: Mon, 13 Dec 2010 14:14:30 +0100
Message-Id: <826C0D02-332C-4888-84D1-4C898EAF3A0F@crissov.de>
To: www-style list <www-style@w3.org>
Eli Morris-Heft:

> [1]. It seems like there was a lot of discussion but that it didn't go all that far.

Yeah, the WG (or vocative vocal seems 

> So I'm
> throwing my proposal into the mix. This proposal is exactly what it says on
> the tin: a way to define new color keywords.
> @color-keyword {
>    keyword: ochre;
>    color: hsl(6, 82%, 37%);
> }

I much prefer

  @color ochre {…}

or, perhaps,

  @color ochre hsl(6deg, 82%, 37%);

> While I can see that this is almost exactly a proper subset of the use cases
> for CSS variables, there doesn't seem to be a lot of movement on variable
> and this is a specific use case that I feel is common enough and simple
> enough that a separate treatment is fine. I think that the main practical
> use will be to make using color schemes easier (so you don't have to
> remember your color's RGB and HSL values) and to make skinning and theming
> easier: instead of having to reproduce all the selectors for the whole site
> in a different file and override their colors, one can simply name the
> colors and swap out the CSS file that defines those colors.
> Whether or not the existing color keywords can be redefined is a matter for
> debate. On the one hand, there is potential for bad code there. On the other
> hand, color keywords are already defined in this way, unless they have some
> magic about them. Though it occurs to me when writing this that the
> potential for bad code combined with the existence of magical color keywords
> means that perhaps not allowing existing color keywords to be used is the
> better course of action. That said, the proposal itself gives the
> opportunity for some horrible code anyway:
> @color-keyword {
>    keyword: cerulean;
>    color: hsl(6, 82%, 37%);
> }
> But I am willing to take this as a price, since any variable-like mechanism
> can be used for bad code like this.
> Thoughts?
> - Eli Morris-Heft
> [1] http://lists.w3.org/Archives/Public/www-style/2010Sep/0460.html
Received on Monday, 13 December 2010 13:15:12 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:41 UTC