What are HEX colour codes?
HEX color codes are used to describe colours for digital use.
A HEX code (hexadecimal color code) is often written with a hashtag (#) and is followed by three or six characters.
Most often you will see HEX colour codes written with six characters. The three digit version, can be seen as a short hand version and can not represent as many colours as a six digit version – more about this later.
Example of a six digit hex colour code:
#FF0000
The first two characters after the hashtag (#) stand for the amount of red, the second two for green, and the last two for blue.
#FF0000
The characters in each pair represents the amount of the colours red, green and blue as hexadecimals. The amount goes from 00 to FF, where 00 is none of that color and FF is the full amount of the color.
In the example above, you will notice that the red value is FF and both green and blue pairs are 00 (meaning none of these colours).
This means that the colors representet by #FF0000 only contains red, and it looks like this:
What the hex – why are there letters in the numbers?
Hexadecimals are not very diffent than “normal numbers”, they just look stranger because they contain both numbers and letters. This is why the are often refered to codes, but in fact, they are just numbers.
Our normal decimal numbering system is based on 10 symbols, from 0 til 9. And this is what we have gotten used to for numbers, therefor is easier to grasp.
The hexidecimal numbering system is based on 16 symbols from 0 to F.
Hex numbers from 0 to 15 (16 symbols in total, including 0) is written like this:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, F
As you can see we the first 5 characters of the alphabet into use.
If you want to write the decimal number 16 with hexidecimal letters, you write is like this: 10
Looks strange right? But in fact you just start again, like with the decimal system when going from 9 to 10.