Your retina, which covers the back of the eye, contains light receptors called rods and cones. Rods are used for night vision and they only let you see in shades of gray. You have only one type of rod but three types of cones. Cones let you see in color as long as it's not very dark.
All three types of cones respond to a wide range of wavelengths, but one type is the most sensitive to long wavelengths (the red end of the spectrum), one to medium wavelengths, and one to short wavelengths (the blue end of the spectrum). With just these three types of cones, we are able to perceive more than a million different colors.
When a red light, a blue light, and a green light are all shining on the screen, the screen looks white because these three colored lights stimulate all three types of cones in your eyes approximately equally, creating the sensation of white. Red, green, and blue are therefore called additive primaries of light.
With these three lights you can make shadows of seven different colors—blue, red, green, black, cyan, magenta, and yellow—by blocking different combinations of lights (click to enlarge diagram below). When you block two lights, you see a shadow of the third color—for example, block the red and green lights and you get a blue shadow. If you block only one of the lights, you get a shadow whose color is a mixture of the other two. Block the red light and the blue and green light mix to create cyan; block the green light and the red and blue light make magenta; block the blue light and red and green make yellow. If you block all three lights, you get a black shadow.
You can achieve a similar effect by turning off different lightbulbs. If you turn off the red light, leaving on only the blue and green lights, the entire screen will appear cyan. And when you hold an object in front of the screen, you will see two shadows, one blue and one green. In one place, the object blocks the light coming from the green bulb, leaving a blue shadow; in the other location it blocks the light from the blue bulb, leaving a green shadow.
When you move the object close to the screen, the shadows overlap, leaving a very dark (black) shadow where the object blocks both lights. When you turn off the green light, leaving on the red and blue lights, the screen will appear to be magenta, a mixture of red and blue. The shadows will be red and blue. When you turn off the blue light, leaving on the red and green lights, the screen will appear to be yellow. The shadows will be red and green.
It may seem strange that a red light and a green light mix to make yellow light on a white screen. It just so happens that a particular mixture of red and green light stimulates the cones in your eyes exactly as much as they’re stimulated by yellow light—that is, by light from the yellow portion of the rainbow—so your eye can't tell the difference. Whether a mixture of red and green light or yellow light alone—whenever the cones in your eye are stimulated in just these proportions, you'll see the color yellow.