W3C home > Mailing lists > Public > www-style@w3.org > June 2003

Re: author-defined color aliases

From: Matt <matt@hogwarts-library.net>
Date: Mon, 16 Jun 2003 21:57:34 +0100
Message-ID: <030f01c3344a$c9434880$812994d9@matt>
To: <www-style@w3.org>

David Dorward wrote:
> The colours would have to be translated in to colours the browser can
> recognise at some stage. There are three places this could be done:
>
> (1) Once before the webserver reads the file
> (2) By the server every time it reads the file
> (3) By the client every time it reads the file (which means throwing
>     away backwards compatibility)
>
> Which is the more efficient?

I think this is the most important reason for not using the proposal: a
browser that doesn't support this could easily make a page illegible --
especially if all colours have been defined using aliases -- they all and up
black. And other properties using the alisases would break, too.

(1) is obviousely far superior, it saves processing time and general
efficiency and the problems of backward compatibility, whilst still
providing all the necessary functions. And lets face it, even without
good-quality editors that can do this preprocessing everyone know how to do
Find and Replace. You can also turn it back or change your mind easily - or
add a comment: color: #f0f /* highlight colour */.

If something _is_ to be used, and I don't think it is in the interests of
the users of the web as a whole, this would perhaps avoid the
backward-compatibility issues:

@propertygroup {
 name: mystylefortables;
 border: 1px solid #f12;
 color: #f6f;
 background-color: #002;
}

.someclass {
 propertygroup: mystylefortables;
}

Used carefully this would allow the CSS to degrade properly. It would also
allow something like this to be done using the @media rule:

@media screen {
  @propertygroup {
    name: anotherstylegroup;
    background-color: #003;
    color: #eef; /* which isn't usually made black when printed, so it
wouldn't show upwhen the background is removed*/
  }
}

@media print {
  @propertygroup {
    name: anotherstylegroup;
    background-color: #fff;
    color: #300;
  }
}

@propertygroup {
  name: anotherstylegroup;
  font-size: 1.2em;
  text-align: center;
}

.someclass {
 propertygroup: anotherstylegroup;
}

This gives a good cascade and a short definition, and avoids repeating
several attributes that are (in this case) the same for print and screen.

I'm still not sure that this is necessary, but I think what I've done would
be a good[1] implementation of the requests we keep getting.

[And I've only been on this list for a month or two and I've seen the
colour-aliases argument twice now;-]

HTH :-)

--
MAtt
[1] I Am Not A Computer Programmar (but I want to be one when I finish
school)
Received on Monday, 16 June 2003 17:02:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:21 GMT