How many hexadecimal color codes are there?
There are 16,777,216 hexadecimal colors using #RRGGBB notation.
Colors in Computers
Colors in computers are expressed by combining red, green and blue in different proportions. There are 2 ways to write a color. RGB which has a range of 0-255 for Red, Green and Blue and the Second way is hexadecimal (#RRGGBB).
HexaDecimal Color Codes
Hexadecimal colors use sixteen different values to represent a single shade of color, whether it be red, green, or blue. Each color is broken down into a number or character, ranging from 0-9 and A-F, where 0 is the minimum value and F is the maximum. The color format is separated into #RRGGBB, where RR is red, GG is green, and BB is blue. Each of the 2-symbol elements expresses a color value from 0 to 255.
- Element 1: Red value
- Element 2: Green value
- Element 3: Blue value
The code is written using a formula that turns each value into a unique 2-digit alphanumeric code. For example, the RGB code (92, 153, 114) is 5C9972 in hexadecimal code. This gives you an idea of just how many color combinations are possible with hex color codes.
There are 6 digits in total with 2 digits for each color channel. Each color channel is described using 1 byte of information. Byte can contain 256 different values. If you use RGB, the range of colors is 0-255. Meaning there are 256 possible values for each Red, Green and Blue. So for 3 channels, it is:
So you have hex 00 00 00 to FF FF FF or using web terminology;
However, modern browsers support transparency - #AARRGGBB.
By similar logic you get:
Here are some examples of hex color codes and their decimal RGB equivalents:
It is important to note that hexadecimal color values are supported in all modern browsers. Also, there is a shorthand version of hex colours used in CSS, where you can write something like #567. This is just shorthand for #556677. It saves a few characters when you have a colour with repeating digits in each channel. For example, white is #FFF instead of #FFFFFF.
NEXT.....Add a Color Picker in your web-site