Human beings can experience color by means of three types of cones in the retina of the eye which are sensitive to wavelengths that roughly correspond to red, green and blue light. The information we see is then encoded and sent to our brain to make us see the full color spectrum. The CCD in our digicam sees color in much the same way. It records the three primary colors, red, green and blue and combines them to make up the colors in an image. This is called the additive color system, because adding all three together at their maximum setting will produce white.
CMY, as used by printers or other output devices, are known as subtractive colors because the required color is produced by subtracting different quantities of cyan, magenta and yellow from white light.
High end digicams use a three shot sensor to record an image. They take three exposures, one for each color and combine them into one image. Most consumer digicams however work with sensors coated with color filters to capture an image with one exposure. Each pixel will represent a mixture of red, green and blue ranging in brightness from 0 to 255. A 24-bit image (8 bits per color) can then render 16.7 million colors. The histogram of an image can show us how the 256 levels of brightness for each color are distributed and if and where correction is needed. Sometimes it will be necessary to adjust white balance or use filters to compensate for different qualities of light present in a scene.