How can we possibly perceive a world of colors from just red, green, and blue, the colors of lights in TV, computer, and phone screens?
The answer has to do with the way our visual system is set up: We have three different kinds of cones in the retina which respond most to what we call red, green, and blue light. (See this post for more about how our visual systems map wavelengths of light into the experience of color.)
Cones are one of your two types (the other type is rods) of photoreceptors, vision sensory neurons in your retina, the back of your eye. Like other sensory neurons, cones transduce (change) energy coming in from the world into neural firing patterns, specifically light energy for cones and rods. Each cone type fires for a range of wavelengths approximately following a normal bell curve distribution, so it fires most for a certain wavelength, less for somewhat longer and shorter ones, and even less for much longer and shorter wavelengths of light.
You might be wondering at this point why we have three cone types instead of just one – wouldn’t that be simpler? Sure, but remember that after transduction, all that the rest of the visual system gets from the cones is a firing rate. If your one cone fires most for a 500nm wavelength, and a little less for both 520nm and 480nm, you wouldn’t be able to tell 520nm apart from 480nm – you would see them as the same color. This is called the problem of univariance.
The problem of univariance makes the point that all you get from sensory neurons is their firing patterns, so if they are firing the same, you end up with the same experience. This brings us back to how digital screens work. Because we have three cone types, if we combine three lights in our screen in the right way, we can mimic the firing pattern caused by any color in the real world: we just need three lights with wavelengths such that there is at least one in the range of each cone type, and then we adjust the intensities and ratios of each light to match our perception of a real-world color. If you happen to be in San Francisco at some point, the Exploratorium museum has an exhibit where you can try out yourself adjusting red, green, and blue lights to match the background to the color of an elephant on a computer screen to make the elephant disappear.
Cones and color ratios also has to do with how color printing and paint mixing works, though combining pigments is a bit different than combining lights. See this post for more info.