Previous Message
Next Message

CSS Specifying HEX Color Codes?

Sent by David Leader on 15 November 2003 22:10

Fred asked:

>HEX COLORS: is #fff better than #ffffff ?

No,it's worse. It is a special-case abbreviation that saves someone 
three keystrokes to produce code that is harder for someone else to 
maintain because, as in your case, they don't understand it. The 
designers of css clearly included the worst kind of brilliant unix/C 
programmers who delight in producing clever compact code that 
unfortunately nobody else can understand. That is probably why they 
were working for free on css as nobody in business could afford the 
consequences of employing them.

He also wrote:

>     In two of the books I'm researching the authors call for
>     "RGB" designations.  It would seem this would give better
>     reliability across platforms and monitors.

This is nonsense. Hexcolours are equivalent to RGB colours, but are 
expressed to a different mathematical base. Because of this the css 
coding is different, but the values of the colours that can be 
obtained is the same. RGB colours, which Photoshop users would be 
familiar with, have 256 possible red, green, and blue values, 
expressed on the familiar decimal scale from 0 to 255 (computer 
scientists start numbering at 0). Thus the colour black is 0,0,0 and 
the colour white is 255,255,255. (Red is 255,0,0 etc)  The 
hexadecimal scale is base 16, so as well as the ten digits 0-9 it 
employs six additional digits a-f. It is used because 256 is 16x16x16 
and so each rgb colour only needs six characters to represent it. 
000000 (= 00,00,00) is black and ffffff (= ff, ff, ff) is white (red 
is ff0000 etc).

So if you use the full hex description there is a chance that you 
might think about what it means.

He also wrote:

>Will using the RGB style tag render these colors more
>faithfully across platforms and monitors?

No. Nothing will currently render colours faithfully across platforms 
and monitors.

Different monitors are set/calibrated differently or have different 
properties, so render colours differently. Also the Mac and PC have 
different colour gamma settings so something that looks fine on my 
Mac looks too dark on a PC monitor. At one time you also had to take 
into consideration how many colours a monitor could display (hence 
the so-called, but not-in-fact, colour-safe palette, that these hex 
triplets were probably coined to represent for 8-bit displays), but 
advances in screen displays mean that this is no longer a real issue.

I imagine, that as hexcolours were used initially in html when the 
font tag was invented, there may be browsers that do not support the 
RGB notation, but whether this is so , and whether it is true for 
css, I have no idea.

However these concerns are not particularly specific to this list, 
and there are many sites on the web which are dedicated to colour 
representation. Adbobe used to have excellent material on this sort 
of thing. Use your Google skills.


css-discuss [EMAIL-REMOVED]]
Supported by --
Previous Message
Next Message

Message thread:

Possibly related: