Sooner or later you run into colors written like this:
#FF0000 #336699 #FFFFFF #000000
Enter fullscreen mode
Exit fullscreen mode
They look random. They aren't. Once you know two things, RGB and hexadecimal, you can read most of them on sight.
This is part 1 of 3. Part 2 covers alpha (transparency) and part 3 covers what happens when a transparent color sits on top of another one. Here I only want to answer one question: how does a computer store a color?
Three numbers
Most screens work with the RGB model: red, green and blue. Each channel gets a value from 0 to 255, so a color is just three numbers:
RGB(255, 0, 0)
Enter fullscreen mode
Exit fullscreen mode
That's red at full strength, no green, no blue. RGB(0, 255, 0) is pure green and RGB(0, 0, 255) is pure blue.
Why 255?
Because a channel is usually stored in 8 bits.…