Hex Color

A hex color also known as hex triplet is a six-digit, three-byte hexadecimal number used in HTML, CSS, SVG, and other computing applications to represent colors. The bytes represent the red, green and blue components of the color.

One byte represents a number in the range 00 to FF (in hexadecimal notation), or 0 to 255 in decimal notation. This represents the least (0) to the most (255) intensity of each of the color components. Indicating that colors for the web are specified in the True Color (24-bit RGB) color scheme.

What comes to mind when you see; #1A1B1B

Televisions, monitors and virtually every electronic color display unit; displays color by combining Red, Green and Blue light known as RGB or its equivalent.

The RGB color model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors. Typical RGB input devices are color televisions, video cameras, image scanners, video games devices and digital cameras. 

This RGB was created to display color of up to 255-bit. That is; you can use colors by setting arrays from 0 to 255 of red, blue and green light to obtain any color.

For example, rgb (255,0,0) is displayed as red, because red is set to its highest value (255) and the others (green and blue ) are set to 0.

The important thing you need to know about hex codes is that they are not  based on ten digits (0 to 9), they are based on 16 digits (0 to F). Six numbers and Six alphabets. 

Hex was originally; a # sign with 6 other numbers. The # sign to tell the compiler or assembler it is dealing with Hex Color.

The 6 figures were to be 1, 2, 3, 4, 5, 6, 7, 8 and 9. with every two of these numbers representing; Red, Green and Blue. As in;

255 of Red(17)       255 of Green(17)       255 of Blue(17)

#      11                           11                              11

That is a hex color of  #111111     = rgb 17,17,17

But there was a constraint. In that, if we used numbers only, we would only be able to represent up to 99 in two digits with the digits (0 to 9). 

To make hex code; able to display up to 255-bit of color and meet with rgb A, B, C, D, E and F were adopted. Where; A = 10       B = 11       C = 12       D = 13       E = 14       F = 15  Becomes the secret recipe. This made the trick;

So #1A1B1B is equal to;

        Rgb             26                27               27
         #              1A                1B               1B   
The secret calculation of the above hex code is; 1*16+10 1*16+11 1*16+11

There you have it, it’s not that complicated. So, the next time you see those numbers and alphabets combination beginning with the “#” sign, say Hi to them for me.

The Mystery behind Hex Color Code