One of the ways computers store color information is Red, Green, Blue (RGB) format. What the computer does is it stores a value from 0 – 255 for each of those three colors. Some examples:
0,0,0 = Black
255,255,255 = White
255,0,0 = Pure Red
0,255,0 = Pure Green
0,0,255 = Pure Blue
And all the various combinations of colors in between. As we know, computers operate in 1’s and 0’s. Bits and bytes. In memory and on disk, it isn’t storing numbers from 0 to 255, it’s storing a single byte, from 00000000 to 11111111.
Writing out all the bits of a byte can be cumbersome, so hexadecimal is often used, because you can represent four bits with a single hex character, or 2 hex characters to represent a single byte. To show the difference, take a look at some of our previous examples in binary and hex:
Black = 00000000,00000000,00000000 or 0x000000
White = 11111111,11111111,11111111 or 0xFFFFFF
Red = 11111111,00000000,00000000 or 0xFF0000
Much more compact and simpler and easy for computers to read and interpret.
In short, when you see a hex color code, the first two characters represent the amount of red, the second two represent the amount of green, and last two represent the amount of blue.