Color perception starts at the retina of the human eye. The
retina has three types of cones, light receptors that have
sensitivity to different ranges of light
frequencies. There are "red" receptors that are most sensitive
to low frequencies, "green" receptors that are most sensitive to
middle frequencies, and "blue" receptors that are most sensitive to
high frequencies.
The ranges of sensitivity overlap considerably, so that even
monochromatic light-- light of a single frequency-- will usually
stimulate all three different types of cone to varying extents.
However, the cones are not digital, on-off devices; they report
varying levels of stimulation, so they provide three channels of
analog information. The retina and the visual cortex of the brain
eventually combine this into information about brightness and
color.
Monochromatic light has a color that corresponds to its
frequency: red has the lowest frequency, then orange, yellow,
green, blue, violet. But the sensation you get from each kind of
light is the result of the relative strengths of the signals from
various cones (among many other things-- I'm simplifying here).
This alone explains a lot of things about color perception. I
used to wonder why there were "primary colors" of light out of
which other colors could be made-- it didn't seem to map onto any
simple statement about frequencies of light. That's because the
fact has more to do with biology than physics. You can produce a
yellow sensation by combining red light and green light (that's how
your color TV or computer monitor does it), but that's not because
the red and green frequencies somehow combine to produce light of
an intermediate, yellow frequency. It's because the red and green
light stimulate the cones in just the same way that the
yellow frequency would!
The primary colors of light (red, green and blue) are those that
stimulate one type of cone most predominantly. People with two
common kinds of "color blindness," deuteranopia and protanopia, do
have some color vision, but effectively see two primaries instead
of three (contrary to what you might think, this is not
because one of the cone types is missing or nonfunctioning, but
because its response curve is shifted to overlap more completely
with that of another cone type).
Dogs and cats seem to see two primaries as well. Honeybees have
more than three primary colors, and one of them is in the
ultraviolet!
Also, ever wonder what frequency magenta light has? It
doesn't-- there's no such thing as monochromatic magenta! It
results from the combination of very low (red) and high (blue or
violet) visible frequencies, with the absence of middle
frequencies. It's the seam where our brains join the ends of the
visible electromagnetic spectrum into a "color wheel" of hues.