Color perception is the mechanism by which some animals translate the properties of visible light into distinctive perceptions that inform them about the surrounding world. Visible light, usually from the sun, contains light in a variety of different wavelengths, some of which are absorbed by any given surface, and some of which are reflected. By picking up the differences in those reflected wavelengths, it's possible to perceive variations in color.
The equipment to discriminate between wavelengths is located in the mammalian eye. Two types of cells, rods and cones, absorb light that passes into the eye. Rods are good at detecting light under poor seeing conditions, but they make little distinction between colors. Cones are packed with special photoreceptors that activate when one of three colors is present in an image. These cells then send a signal to the brain that becomes more rapid and intense with higher levels of stimulation at their dedicated wavelengths.
The visual cortex of the brain receives these signals and synthesizes them into a coherent picture of the world. If the long-wavelength receptors are firing intensely, the brain perceives this as a reddish image. Short-wavelength stimulation is interpreted as imparting a bluish effect. The brain organizes these inputs into a unified image that makes sense to the animal.