David Novak David Novak - 10 months ago 33
CSS Question

Web colors hexadecimal notation

Usually colors in hexadecimal notation are presented with a hashtag following 6 hexadecimal characters. What color does the value #AAA produce? Are the other characters derived from the existing ones? Are the missing values just assumed?


Nice question.

Short answer: #xyz is read as #xxyyzz, so the specific example means #aaa becomes #aaaaaa, a gray quite dark tone (68.75%).

Wikipedia calls this shorthand hex form, https://en.wikipedia.org/wiki/Web_colors#Shorthand_hexadecimal_form

CSS does have a formal specification, but it is a very long read. To experiment with the specific colors that CSS allows, maybe browser debuggers is good. jsfiddle is also a possibility: http://jsfiddle.net/mYdb5/ which contains the following simple code:

Color test:<br/>

div {
    background-color: #aaa;