The computer stores colors as a combination of the three primary colors of light. These three colors are Red, Green and Blue. When the computer is to display a color it must be told what intensities of the three colors to mix. HTML uses what is called a "Hex Triplet" to describe the levels of each of the three colors.
In order to make it inconvenient to users, computers use what are called Hexadecimal numbers. Hexadecimal are simply base 16 numbers. In everyday life base 10 is used, meaning the digits: { 0 1 2 3 4 5 6 7 8 9 }. Base 16 uses the digits: { 0 1 2 3 4 5 6 7 8 9 A B C D E F }. This means that every decimal point is worth 16 instead of the usual 10. A table of a few decimal numbers and their hexadecimal equivalents is displayed below.
| DEC | 1 | 2 | 3 | ... | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ... | 29 | 30 | 31 | 32 | 33 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| HEX | 1 | 2 | 3 | ... | 9 | A | B | C | D | E | F | 10 | 11 | ... | 1D | 1E | 1F | 20 | 21 |
Impressed yet? didn't think so. The "Hex Triplet" mentioned above is, as is easy to guess, composed of three hexadecimal numbers, each one representing the intensity of one of the three primary colors of light.
A Hex Triplet is a hash ( # ) followed by a six digit hex number. The first two digits represent the intensity of Red, the next two represent Green, and the last two represent Blue. The minimum two digit hex number is of course '00' and the maximum is 'FF'. So to make bright red the Hex Triplet is "#FF0000" which says maximum red, no green, no blue. Similarly bright green is "#00FF00" saying no red, maximum green, no blue. Finally following the same lead is bright blue "#0000FF".
To get gray you can mix equal proportions of all three colors. Thus "#808080" is medium gray (80 being 1/2 of FF), "#FFFFFF" is really bright gray (commonly called white), and "#000000" is really dark gray (commonly called black).
To get yellow you can mix equal proportions of red and green "#FFFF00". Purple is a mix of red and blue "#800080". Millions of colors can be made this way, but most computers will only display 256 colors or less, therefore most colors are rounded. That is why "#800080" won't differ from "#810081".
There is a table of color names, color samples and corresponding hex triplets available. It is imaginatively entitled : Color Table