I couldn’t resist adding to this because color theory and the science behind it is so neat.
So to elaborate on why RYB is the primary color set for paint but RGB is the primary color set of actual light, it boils down to how light behaves and how our eyes interpret colors. We see colors because, as was stated, we have sensors in our eyes tuned to the red, blue and green wavelengths of light. When light enters our eyes, these sensors send signals to our brain telling us the relative intensity of each wavelength, and the brain interprets this as colors. Red, Blue and Green are considered additive color, because different colors are achieved by adding different amounts of red, green and blue, while white light is achieved by adding the three together. Thus, when your eye detects equal amounts of red, green and blue light, you see the color white.
However, if you’ve ever painted anything you’ll know that mixing red, green and blue generally gives you a dark muddy brown or black color, not white. Why is this? Because there is a difference between the way light interacts with your eyes and how it interacts with pigments on the page. When light hits a pigment on the page, some of the wavelengths are absorbed, and others are reflected. Red, for example, absorbs all wavelengths except red, which is then reflected away. So looking at something that is red means that it actually absorbs all other colors of light except for red, which your eye detects. This is called subtractive color, where different colors are made by absorbing (or subtracting) different wavelengths. So, mixing red and blue, for example, which absorbed everything but red and everything but blue, respectively, when mixed will give us something that absorbs some red, and some blue, but reflects the rest, while absorbing all of the green.
The difference between additive and subtractive color boils down to whether you are getting colors by emitting light directly into our eyes, like on a computer screen, or absorbing and reflecting light, like with ink or paint.
The reason Cyan, Magenta and Yellow are used nowadays has to do with the fact that color theory as a science evolved after Red, Blue and Yellow were considered to be the primary colors. That was an idea that predated modern color theory, and was developed around the 18th-19th century. (Some painters actually at times considered there to be four primary colors, red, blue, yellow and green.) The CMYK system (Cyan, Magenta, Yellow and “Key” [black]) evolved from a better understanding of how light and colors behave. Cyan is a complementary color to red as was mentioned above, meaning that it absorbs ALL red light that hits it, unlike other colors which will absorb at best most but not all red light. So cyan can be used to control how much red reflects off the page towards our eyes. Magenta is similarly the complement of green, and yellow the complement of blue. Printers realized that by moving from RBY to CMY they would be able to produce a much wider range of colors with better control, by considering not what colors their ink will add, but based on what colors of light their ink will subtract from white light.
Now something that I discovered a while ago that I find fascinating has to do with how our brains interpret color and the nature of visible light.
This is the visible spectrum of light. Note that unlike color wheels, the colors don’t loop back around. You have blue at one end (ok, indigo, whatever) and red at the other, and green in the middle. Because light is a spectrum, you can have very slight gradations of color determined by the wavelength of light. However, your eyes only have red, blue and green sensors. So what your brain does is it looks at things like “ok, red is firing, but none of the other sensors, so that must be red”. Our sensors, however, are not ENTIRELY unable to detect other colors, its just that different wavelengths don’t cause as strong of a reaction from the sensors. So when the brain detects “some green is firing but so is some red, but neither a huge amount, so that must be some shade of yellow.” Thus our brains detects yellow light, which is a wavelength between red and green, by seeing that both red and green sensors are being tripped, but neither of them as much as pure red or pure green would.
Now, where this gets really interesting is with purple. If you’ll notice, there is not a wavelength associated with “purple light” (and no, indigo doesn’t count). “Purple” as we understand to be a mix of red and blue, doesn’t exist in the visible spectrum. However, we can see the color purple. How? By a cool trick our brain uses to sort through colored light inputs. If your eye is detecting both red and green light, but not blue, it determines it must be a wavelength of light halfway between, or in other words, yellow. When it detects green and blue, it determines that it must be cyan, which is halfway between the two. However, halfway between red light and blue light is green light. So what our brain does is it says, “ok, red and blue are both firing, but I’m not getting anything from the green sensors, so it can’t be green”. Basically purple is your brain’s way of telling you that you’re looking at “not-green”, or a mix of red and blue light that doesn’t have an actual corresponding wavelength in the visible spectrum. Thus purple is not a color of light your eyes detect, so much as it is a way for your brain to comprehend the absence of green light. Brains are weird and wonderful.