Personal Computer Color Mathematics

The methods used to present colors within personal computers are a mixture of color theory, electronic component technology, cost, software expedience, and designer preferences.

While modern cathode ray tubes (CRTs) can present an infinite variety of colors, the specific colors to be shown are stored in digital indexes within the computer's main and/or display memory. This implies that the variety of colors actually employed will be limited to the maximum size of the memory cells allocated for each color. The number of colors which can be displayed is often further limited by the common technique of providing a small array of such colors (the "Palette").

Pixel
Value
points to --> Palette points to --> RGB Color
Coördinates

The RGB (red, green, blue) Color Coördinates are given in terms of a value for each color component in the RGB system. Normally, they have an equal number of possible values, and that range for each component is determined by the number of bits allocated for each. Most systems use an equal number of bits (and hence an equal range of values) for R, G, and B, though there are systems which use unequal numbers of bits (e.g., 3-3-2). These values are stored in the Palette. The combined RGB bit width stored in the Palette is usually a convenient multiple of 2, typically 224 = 16,777,216.

In turn, however, the width of the Pixel Value is normally much smaller, typically 3, 4, or 8 bits wide, thereby limiting the number of possible Palette values which are actually employed. For 3, 4, and 8 bits, for example, the number of values would be 8 (= 23), 16 (= 24), and 256 (= 28), respectively.

The following table summarizes these constraints.

Each RGB
Component
Potential
Colors
Next
Largest
Power of 2
Increments
Fraction % 8-bit 16-bit
BitsValues DecHex DecHex
1 2 = 21 8 = 23 8 = 23 1100.0 255FF 65535FFFF
2 3 27 = 33 32 = 25 1/250.0 12880 328968080
4 = 22 64 = 43 64 = 26 1/333.3 8555 218455555
3 5 125 = 53 128 = 27 1/425.0 6440 164484040
6 216 = 63 256 = 28 1/520.0 5133 131073333
7 343 = 73 512 = 29 1/616.7 432B 110512B2B
8 = 23 512 = 83 512 = 29 1/714.3 3624 92522424
4 16 = 24 4,096 = 163 4,096 = 212 1/156.7 1711 43691111
5 32 = 25 32,768 = 323 32,768 = 215 1/313.2 808 20560808
6 64 = 26 262,144 = 643 262,144 = 218 1/631.6 404 10280404
7 128 = 27 2,097,152 = 1283 2,097,152 = 221 1/1270.8 202 5140202
8 256 = 28 16,777,216 = 2563 16,777,216 = 224 1/2550.4 101 2570101

This page and its contents are copyright © 1997-2001 by Alphabet Systems, Inc.