![]() |
Used properly, colors can improve the visual appeal of a web page and make it more understandable. Computer monitors contain three color gunsone each of red, green, and bluewhich are used to produce the colors displayed on the screen. The value for each color is designated by a number in the range of 0 through 255 where 0 is the lowest value the color can have and 255 means it's going full blast. With 256 values available for each color gun, the total number of possible colors that can be displayed by a good video system is 16,777,216. That's just a few more than what you get in your standard box of Crayola® Crayons.
Colors are typically specified in HTML by giving the values for red, green, and blue in hexadecimal, or base 16. The hexadecimal numbering system is foreign to most people, but because of the way computers operate it is an excellent way to represent numbers that are stored in a computer. We humans are accustomed to using the decimal system, or base 10. While the more familiar decimal system uses ten digits, 0-9, to represent number, the hexadecimal system as 16 digits. The following table shows how the digits in the two numbering systems compare.
| Decimal: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| Hexadecimal: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
Fortunately, you don't need to much about hexadecimal to specify color numbers in your web pages. Let's say you wanted to use the color red. This means the RGB values for red, green, and blue would be 255, 0, and 0. The would be expressed in hexadecimal as #FF0000, where the first two digits are red, the next two are green, and the last two are blue. Try out the Color Selector and supply your own values for red, green, and blue to change the background color of a web page so you can see how it looks with text of different colors.
Many web page editors have color selection tools that let you pick a color and the program will automatically insert the appropriate hexadecimal code for you. Alternatively, you can choose a color from the list of 140 named colors. These color names are used in place of the hexadecimal code.