Web Colors: Why Red, Green, and Blue?
part of our series “Everything You Ever Wanted to Know About Hex Colors”
This is a fascinating question, and to answer it well, we need to consider why in the realms of both science broadly, and computer science specifically.
The science
The short answer is that red, green, and blue are the primary colors of light. In the 1660s, Sir Isaac Newton (yes, that Sir Isaac Newton) did work with prisms to identify what he saw as 7 different colors — the ROY G. BIV rainbow you learned in elementary school art classes.
It wasn’t until the 1720s that the painter J. C. LeBlon published a book insisting that there were actually only three primary colors, and the others are just mixtures thereof.
LeBlon also argued that light and pigment, though both examples of color, actually behave in opposite ways. The more light you add, the brighter a color gets, so it’s considered additive. The more paint you add, the darker it gets, so it’s considered subtractive.
The computer science
Since computer monitors basically involve lighting up almost-microscopic lights in a massive grid, the color on your computer uses the additive system of mixing colors of light. In fact, here’s an up-close photo of an iPad 3 next to its older brother back when Retina display was first introduced:
Look at how much smaller the pixels are on a Retina display! No wonder it looks more crisp.
Each pixel is actually made of three almost-microscopic light sources. You can see that the individual subpixels are red, green, and blue, so the RGB/hex color mixtures aren’t arbitrary — you’re literally telling each of the three colored subpixels how brightly they need to light up.
You’re not just writing a program, you’re essentially playing with an enormous-scale Lite-brite!