There are three types of cones in the retina, sensitive to 3 ranges of light wavelengths, roughly corresponding to red, green and blue. The mixture of levels of stimulation of the three types of cones give us a sense of colour. The colours that can be sensed by the eye are restricted to a very small segment of the electromagnetic spectrum.
Colour is essentially invented by the eye. It is not a physical property of the world. The cones are sensitive to specific wavelengths of light, but a perceived colour does not map back to a specific wavelength of light. Light with a wavelength of 600 nm appears yellow but so does a mixture of light of wavelength 550 nm (green) and 650 nm (red). While the wavelengths of electromagnetic radiation stretch out as a linear continuum, colour as the eye sees it is best represented by a colour wheel. In the colour wheel, red and violet meet and comfortably blend into each other, whereas in the spectrum, red and purple are the farthest apart of the visible colours.
The impulses from the rods and cones are modified into 3 types of neural signals: a red-green signal, a blue-yellow signal and a dark-light signal. These are called opponent signals because they express the specific balance of these opposing colour features at any particular point in the retina. These signals are then relayed from each eye to the visual cortex of the brain via the optic nerves, bundles of approximately 1.5 million nerve fibers.
We can generally distinguish a hundred or so hues within this spectrum. With the addition of the dimension of brightness and saturation to hue, we can sense approximately 10 million individual colours. However, this colour sense is primarily relative; we can only distinguish the most similar of these colours if they are placed side by side. Similar colours shown separately would tend to be indistinguishable. This is partly because the colour we perceive an object to have is adjusted by the visual cortex to adapt to what the cortex senses is the colour temperature of the light falling on the object. This is why a white piece of paper looks white under the warm orangish light of incandescent light (when it is objectively quite orange) as well as in direct sunlight which is much whiter light. (This is similar to the idea of colour balance in cameras. Unless the camera makes an artificial adjustment that mirrors what our eyes automatically do, the pictures taken at night in lit rooms look very orange, and picture taken in daylight tend to look too blue.) These adaptations are useful for the recognition of objects, but on the other hand reduce our ability to usefully distinguish similar colours.