[whatwg] [Slightly OT(?)] Programmatically defined styles [Re: Superset encodings [Re: ISO-8859-* and the C1 control range]]

Øistein E. Andersen html5 at xn--istein-9xa.com
Fri May 30 12:25:40 PDT 2008


On 22 May 2008, at 11:40, Ian Hickson wrote:

> [I wrote:]
>> PS: How should colour be added to tables like these in HTML5 with
>>     neither of the attributes bgcolor and style?
>
> Class attribute and external stylesheets. (Possibly a data-* attribute.)

I actually thought this might be one of the cases that could reasonably
and legitimately be solved using the style attribute (which was, I believe,
still absent from the draft when my PS was written), so it is interesting
to see that you think otherwise. I would like to point out that your suggested
solution would require a style sheet along the following lines:

        .bg-00 {background-color: #00ff40} /* green */
        .bg-01 {background-color: #02ff40}
        .bg-02 {background-color: #04ff41}
                    /* ... */
        .bg-7e {background-color: #fcff7f}
        .bg-7f {background-color: #feff7f}
        .bg-80 {background-color: #fffe7f}
        .bg-81 {background-color: #fffc7f}
                    /* ... */
        .bg-fd {background-color: #ff0441}
        .bg-fe {background-color: #ff0240}
        .bg-ff {background-color: #ff0040} /* red*/

Adding 256 classes (of which 100--200 are actually used in each document)
is certainly feasible.

However, this solution would not seem to be practical for a colour scheme
using a larger number of colours. Would your mantra remain the same
given, e.g., 256^2 or 64^3 distinct shades of colour? If not, where should
the boundary be drawn?

-- 
Øistein E. Andersen





More information about the whatwg mailing list