- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Sat, 11 Dec 2010 11:53:39 -0800
- To: Eli Morris-Heft <eli.morris.heft@gmail.com>
- Cc: www-style list <www-style@w3.org>
On Sat, Dec 11, 2010 at 6:15 AM, Eli Morris-Heft <eli.morris.heft@gmail.com> wrote: > While working on a website that is about to suffer a subtle but > wide-reaching color scheme change, I was thinking about how nice it would > have been to be able to create color keywords for my color scheme colors. > Then I recalled that I had read something similar on this list a while back, > so I went and read the relevant thread in the archives[1]. It seems like > there was a lot of discussion but that it didn't go all that far. 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%); > } > > a { > color: ochre; /* is the same as color: hsl(6, 82%, 37%); */ > } > > The value for keyword must be a proper CSS keyword. (Which I believe means > it must match /[a-zA-z0-9-]+/.) > The value for color must be a <color>. > > 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. Unless it offers significant functionality over plain variables, I don't think it's worthwhile to define mini-variables that only work in limited circumstances. This is one place where plain variables address your case exactly. We should instead work on plain variables. ~TJ
Received on Saturday, 11 December 2010 19:54:31 UTC