Re: [css3-color] #rrggbbaa annotation

On 2010-03-24 8:12 PM, Alberto Lepe wrote:
> We can't wait until CSS4 for this feature as most of the sites will
> be already using the RGBA or HSLA annotation to accomplish color
> transparency (by then), which will make the #RRGGBBAA recommendation
>  out of time and useless in CSS4.

If this feature would be "useless" in the future, then there's no reason
to implement it /now/.

> I think most developers uses the HEX annotation because it is just
> simpler, shorter, cleaner and widely used in graphical applications.

It's shorter and therefore easier to type assuming that you know what
you're doing. It's also easier to cut-and-paste and cleaner looking.

However, I don't think that it's simpler; e.g., in the case of two hex
digits, the calculation to obtain the decimal value from "XY" would be
the expression "16X + Y" where the A, B, C, D, E, and F values for "X"
and "Y" are equal to 10, 11, 12, 13, 14, and 15, respectively. So "FF"
would be equal to "16*15 + 15" or 255. I doubt that most developers
understand that and, thus, have to assume that most people get their
color values via a code generator, by copying-and-pasting, or via
memorization of the codes for key colors rather than by actually using
the notation itself to pick a color. It doesn't really matter what the
notation is if people are just copying, but it does matter if you're
trying to create something that people can use and read easily without
resorting to a color picker (e.g., to create a new color or to figure
out what color that a style sheet is referencing).

As for graphical applications, you do have a point there: it would
certainly be easier to tack "AA" onto the end of a graphical
application's color generator #RRGGBB output than to manually convert it
to RGBA or HSLA functional notation assuming that the generator doesn't
already output functional CSS color values like those for RGB, RGBA,
HSL, and HSLA.

But, then again, you're back to the problem of simplicity with #RRGGBBAA
since you have to know what that "AA" you want to tag onto the end of
the the #RRGGBB notation is in the first place: you're assuming that the
developer knows that 55 maps to "16*5 + 5" or "85/255" or ~33.33%
opacity (assuming that "00" maps to 0% opacity). I have a feeling that
your average author would assume that "AA" is decimal rather than
hexadecimal and, thus, that 55 indicates 55% opacity (unlike with color,
I've never seen any program represent opacity as anything other than a
decimal number or percentage).

And if they knew how hexadecimal worked, they would still have a
headache from trying to do the math to get the hex value for something
as simple as 50% opacity: reversing the expression "16X + Y", you need
to find that "50%*255" is 127.5 and "127.5/16" is 7 with a remainder of
15.5. 7 is represented as 7 in hex (that's straightforward), but there's
no way to represent fractions of a number in hex, so you have to round
15.5 up or down to 16 or 15 ("F" or "E"):

7E = 16*7 + 15 = 127; 127/255 = ~49.80%
7F = 16*7 + 16 = 128; 128/255 = ~50.20%

(There's no way to get an exact value of 50% in hex.)

So how many people do you estimate would actually type up one of these
values from scratch (i.e., without the aid of a generator) to change the
opacity to anything besides the easy "00" and "FF" (which are already
covered by the |transparent| keyword and #RRGGBB, respectively)?

> What do we (interested people) have to do in order to make it
> possible? I believe this is the correct place to ask for that
> feature, right?

Your best bet would probably be to go file enhancement bugs with the
browser engine vendors that allow it; right now, that's Mozilla
(Firefox) and WebKit (Chrome and Safari).

Received on Thursday, 25 March 2010 07:13:49 UTC