About Colors
About Colors

It is not necessary to understand the nature of color for HTML, but colors will be used a lot, and there is a lot of confusion about the nature of colors that might at least be interesting, if not absolutely necessary.

Kinds of Primary Colors

There are three kinds of primary colors: "opaque," subtractive, and additive.

The opaque primary colors are the first one's we learn, and the ones artists and paint mixers use. Think of the illustration as colors of paint on a palette. The outside colors (red, blue, and yellow) are your basic pigments. The inner colors (purple, green, orange, and black) are made by mixing the basic pigments. You make purple my mixing red and blue, for example.

[NOTE: The color represented as black, in practice will always be some shade of grey, because, while all the colors are absorbed, only 2/3s of each is absorbed leaving 1/3 of of each to be reflected.]

The subtractive pimary colors are those used by photographers and printers and stage lighting hands. Think of the illustration as overlapping colored filters. The outside colors (cyan, magenta, and yellow) are the actual colors of the filters. The inside colors (blue, red, green, and black) are where the filters overlap. The resulting color of light filtered through both a cyan and magenta filter is blue, for example.

The additive primary colors are the primary colors of light, which means they determine how all the primary colors work. The additive primary colors are called RGB (Red, Green, Blue), and are the primary colors used in HTML. Think of the illustration as three spot lights projected on the same screen. The outside colors (red, green, and blue) are the actual colors of the spotlights. The inside colors (yellow, cyan, magenta, and white) are the colors resulting from the "mixing" of light where the spotlights overlap. Red light and green light projected on the same screen produces the color yellow, for example.

Physics and Physiology

Prism experiments demonstrate white light is actually comprised of light of every color. Physically, every color is a single different specific wavelength of the spectrum.

For example, for light in the 400 to 700 nanometers (nm) range, some specific colors have the following wave lengths:

violet 400 nm, indigo 445 nm, blue 475 nm, green 510 nm, yellow 570 nm, orenge 590 nm, red 650 nm.

Physically, new colors cannot be produced by adding colors together, yet that is exactly what we experience when we see more than one color projected onto a screen, for example. That is because the way we see colors (the physiology of sight) is not as separate wavelengths of light, but as a sum of all the light waves reaching the eye.

The human eye has light receptors called cones for only three colors which happen to be the same as the additive primary colors, red, green, and blue. Those colors refer more to what colors they represent than what they are sensitive to, because they are all sensitive to a range of colors dominated by their color designation. If this were not true, no pure color of the spectrum could be seen.

It is interesting to note that the colors we see may not be the colors reaching the eye at all. For example, when we see orange it might be pure orange light (590 nm), but might be a combination of red (650 nm) and green (510 nm) light with no orange light at all.

The color orange we see is the result of light stimulating the red and green cones. The reason we see orange when either pure spectral orange light reaches the eye or when the appropriate combination of red and green light reaches the eye is because the red and green cones respond equally to pure orange light (which stimulates both) and to separate stimulations by red and green light. The color we see, therefore, does not represent the color of light reaching the eye, but how that light stimulates the cones.

Color Vision is Correct

Do not get the impression that the colors we see do not reflect colors as they exist in nature. The method by which our visual system interprets colors is the only one that could possibly see all colors correctly. If, for example, the visual system had cells that responded only to pure spectral colors, since the spectrum is continuous, an infinite number of different cells responding to every possible color would be required. Since that is impossible, such a system would only be able to supply a limited number of different color cells, always leaving gaps in color sensitivity—there would always be colors that could not be seen.

The rgb system, in fact, is able to see all colors of the spectrum, and the correct color of all things in nature, whether pure spectral colors, or combinations of colors.

Relationships Between Primary Colors

The relationships between the different primary colors demonstrates the beauty and perfection of human color vision. To explain these relationships, I am not going to use the hexadecimal color system used by computers. Instead I'll designate all color values with a range of zero (0) to sixteen (16) with the number preceded by its color abbreviation. O represents none of a color, 16 represents its maximum possible intensity. Therefore, r16 means red at full intensity.

Red light, then, is the combination r16+g0+b0. Other combinations are as follows:

Red: r16+g0+b0
Green: r0+g16+b0
Blue: r0+g0+b16
Yellow: r16+g16+b0
Cyan: r0+g16+b16
Magenta: r16+g0+b16
Orange: r16+g8+b0
Lime Green:    r8+g16+b0
violet: r11+g0+b16
aqua: r0+g8+b16
white: r16+g16+b16

(In this discussion, white light is assumed to be the source.)

The primary colors of pigments are determined primarily by the colors they absorb. All colors not absorbed are reflected as the color of the pigment. Yellow pigment absorbs blue light (r0+g0+b16), leaving the red (r16+g0+b0) and green (r0+g16+b0) to be reflected, which added together is yellow (r16+g16+b0).

Red pigment absorbs green (r0+g16+b0) and blue (r0+g0+b16) light, leaving red (r16+g0+b0) to be reflected. But what happens when we mix red and yellow pigment? We know that mixture produces orange, but how does it do that?

Assuming we mix the pigments in equal quantities, it would seem since yellow absorbs blue (r0+g0+b16), and red absorbs green (r0+g16+b0) and blue (r0+g0+b16), there would only be red left to be reflected, but there is only half of each pigment. The yellow and Red pigments both absorb blue, so there is no blue light reflected, but only half the pigment mixture absorbs green and none absorbs red. Since half the pigment reflects green, the total reflected color is orange (r16+g8+b0).

Notice, the effective color can also be considered an average of the effective colors of each pigment:

Red: r16+g0+b0
+ Yellow:    r16+g16+b0

=           r32+g16+b0

÷ 2 = Orange:    r16+g8+b0

This is exactly what all visible colors are, the average of all colors reaching the eye for any given colored area. The single spectral colors are seen in exactly the same way, except that the average of any one value is that value. The so called spectral colors are each only the simplest average of all color combinations that can produce that color.

The Subtractive Primary Colors

The subtractive primary colors are also determined by the colors absorbed by the "filters." (The filters can be pigments in a slide or transparent inks on white paper, for example.) The difference is, that filters do not add up fractionally as pigments do. For each filter combination, the combined absorbtion is the total of the absorbtion for each filter, not the average.

(For filters, the color values indicate how much of a color it will transmit; 0 means it passes none, 16 means it passes all.)

In the above illustration, the overlapping of a cyan and magenta filter results in a blue filter, because cyan (r0+g16+b16) passes only green and blue but absorbs all the red, and magenta (r16+g0+b16) passes only red and blue but absorbs all the green, leaving only blue to pass through.