The hexadecimal number system is based on powers of 16. The digits in the hexadecimal system are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E and F. Some examples of hexadecimal numbers relevant to our discussion include.
decimal | hexadecimal |
0 | 00 |
51 | 33 |
102 | 66 |
153 | 99 |
204 | CC |
255 | FF |
Bit depth refers to the number of bits used to describe the color of a single pixel. As seen in the table below, more bits means more colors.
Bit Depth | Color Resolution |
1 bit | 2 colors |
2 bit | 4 colors |
3 bit | 8 colors |
4 bit | 16 colors |
5 bit | 32 colors |
6 bit | 64 colors |
7 bit | 128 colors |
8 bits | 256 colors |
16 bits | 65,536 colors |
24 bits | 16,777,216 colors |
The RGB color system creates colors using combinations of red, green and blue. Each color is assigned a decimal number between 0 and 255 or a hexadecimal number between 00 and FF. If all three colors are set to 00 , the resulting color is black. If all three colors are set to FF, the resulting color is white. Since there are 256 different shades of red, green and blue the RGB color system supports a total of 256*256*256 = 16,777,216 possible colors. Some example of the RGB color system include
FF0000 | red |
00FF00 | green |
0000FF | blue |
Computer hardware makes it convenient to work with powers of 2 and all modern monitors support 8 bit color (256 colors). Most monitors in fact support 24 bit color or more. Software designers on the other hand work with color cubes. The largest cube less than 256 happens to be 63 = 216. The 216 colors are obtained by partitioning the range 0-255 into the six equally spaced values 0,51,102,153,204 and 255. In hexadecimal these numbers are 00, 33, 66, 99, CC and FF. Hence, web safe colors will always use these digits. Hence, you will see many references to the 216 Web Safe colors. These are the colors that a browser can display directly without dithering. Dithering is a process