Hexadecimal Color Specifications

Another place where hexadecimal numbers show up often is in the specification of colors on the Internet. Most likely you have seen a monitor that claims to display millions of colors, or perhaps claims exactly 16,777,216 colors. It is not a coincidence that this number is exactly \(256^3=2^8\times2^8\times2^8\). Colors are specified on computer screens as combinations of red, green, and blue, or in computer-speak: RGB. The intensity of each color component is typically an eight-bit number - an octet. Again, this is frequently written using hexadecimal notation. Thus, it is common to see a color written as a six-digit hexadecimal number. The first two digits denote the intensity of the red component of the color, the second two denote the green component, and the third pair denote the intensity of the blue. Some examples of color specifications follow.

Example: [HexColor] 
FFFFFF - maximum red, maximum green, maximum blue - white;
000000 - no red, no green, no blue - black;
FF0000 - maximum red, no green, no blue - red;
600000 - less than half red, no green, no blue - dark red;
006000 - no red, less than half green, no blue - dark green;
FFFF00 - maximum red, maximum green, no blue - yellow;
B0B0B0 - equal amounts red, green, blue - light gray
E0E0FF - E0E0E0 + 00001F, i.e. light gray + a little bit of blue - light blue.
The last item from the example points out a peculiarity of color specifications: the smallest number from among the red, green, and blue components determines the amount of white (or gray, if you will) in the color. In particular, the last color should be viewed as E0E0E0+00001F, or in words, as light gray with a little bit of blue.

We'll discuss colors more when we talk about HTML.