Yellow, cyan (light blue) and magenta (purple) are the subtractive primary colours. The white background is a mixture of the additive primaries red, green and blue.
Each subtractive primary removes just one of those colours; for example, yellow takes away all the blue, leaving just red and green. And your eye perceives a mixture of red and green as just one colour, yellow.
Can you figure out what colours magenta and cyan subtract? Try it out, then check the answer:
The colours you get by overlapping the balls in pairs are the additive primaries. That's because each subtractive primary takes away just one colour from the background. So, two subtractive primaries let only red, or green, or blue get through.
This is the way paint and crayons mix. Try it with some crayons and a white piece of paper.
What about Red, Yellow and Blue?
Paint and crayons work by subtracting colours. So, the primary colours for paint and crayons are the subtractive primaries, yellow, cyan and magenta. (For example, yellow works by taking the blue away from white light.)
Cyan and magenta look like shades of blue and red, so they are sometimes called simply that - blue and red.
That's why many people list the subtractive primaries as red, yellow and blue. The subtractive primary "blue" is really a particular shade of light greenish-blue, called cyan; and the subtractive primary "red" is a light purplish-red, called magenta.
Did you know?
What you've seen here is not really happening! The only colours your computer can display are red, green and blue, so the game simulates yellow by turning off all the blue pixels in the ball. On the computer screen, the "yellow" ball isn't really yellow, it's a "no-blue-allowed" ball.