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

Re: [css3-color] #rrggbbaa annotation

From: Patrick Garies <pgaries@fastmail.us>
Date: Tue, 06 Apr 2010 01:09:40 -0500
Message-ID: <4BBAD024.9030300@fastmail.us>
To: Biju <bijumaillist@gmail.com>
CC: www-style list <www-style@w3.org>
On 2010-04-05 7:46 PM, Biju wrote:
> In my experience teaching #C0C0C0 to a new comer is easy, they see it
> as a Label or a code.
> And for those who are interested, you can explain how to compute it.

Telling them what it is and teaching them how to use and read it are two 
different things; I agree that it's generally not a problem for people 
to understand that hex notation is used to reference a color. However, 
what you're saying is "easy" appears to be the first thing (i.e., 
telling them what it is), not the second thing (teaching them how to use 
and read it).

Ask your average author how hex notation works and I really doubt that 
you'd get many that can provide you the very simple formula; as 
previously mentioned, most of them probably copy-and-paste with no 
actual understanding.

As David indicated, this gets worse when someone is trying to read that 
style sheet to edit it (sometimes the same person) and can't see what 
color is actually being used without going into the document and 
tracking down the rendered element or doing a reverse copy-and-paste 
into a color generator.

Alpha transparency in hexadecimal will likewise become incomprehensible 
for many authors and readers if added; the formula isn't even the same 
because you're doing a conversion to 100 instead of 255 so that's 
another calculation to remember:

To 255: 15a + b;
Example: #BC
1. 15(11) + 12
2. 165 + 12
3. 177 Red/Green/Blue

To 100: (15a + b) / 255;
Example: #BC
1. (15(11) + 12) / 255
2. (165 + 12) / 255
3. 177 / 255
4. 69.4% Opacity

> But for the case of rgb(), first of all it looks like a function and
> everybody will see it as complex scientific function

I disagree. The notation seems clean enough not to invoke the idea 
"complex scientific function"; it involves three comma-separated 
integers or percentages without any use of operators and the order and 
meaning of the numbers is made clearer by the preceding "rgb".

> so you start explaining the mathematics behind it and at end most
> newcomers will get completely lost.
 >
> How can a base 256 parameter for rgb() ever become easier to teach
> than a hexadecimal?

I disagree; the process is more straightforward. The process behind it 
is exactly the same as hexadecimal except that you don't have to do the 
back and forth conversion between decimal and hexadecimal.

If the mathematics behind RGB functional notation is incomprehensible, 
then it follows that the mathematics behind hex notation is even less 
comprehensible due to the extra conversions required.

Further, you seem to be forgetting that RGB functional notation accepts 
percentages as well as decimal numbers, which means that working on a 
scale of 0 to 255 is not strictly necessary.

For example, if I want 60% Blue, then I don't need to do the calculation 
0.6 * 255 = 153; I can just type 60% and be done with it. (Notably, that 
conversion is still easier than what you need for hex.)
Received on Tuesday, 6 April 2010 06:10:18 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:26 GMT