Nov 19, 2017 06:31 AM
(This post was last modified: Nov 19, 2017 09:20 AM by ShadowReaperZ.)
Intro
Ever wondered how computers can read that #8b0000 is the color dark red?
And why is hex a based 16 system?
Today I want to share my knowledge to make this clearer to you.
RGB
The post you are reading now is made of tiny pixels on your screen (1920x1080) in my case.
Every pixel has a red, green, and blue light (RGB). These colors are added together to produce what your eyes see as 1 color.
Hex
So now we know what RGB stands for and what function it has, lets focus on what Hex does.
Hex is a 6-digit code (#123456) with 3 different parts.
1 = 12 (Red)
2 = 34 (Green)
3 = 56 (Blue)
Hex tells the computer how much to use of each light from the RGB.
The 16-based system
0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F
Hex has a 16-based system so that more than 99 values can be held in 2 digits. Because of this the computer can read more than 16 million combinations.
A stands for 10
B stands for 11
C stands for 12
D stands for 13
E stands for 14
F stands for 15
0 to F (15) = 16
Every digit needs to be multiplied to 16 and be squared to the power of its place.
Example Hexdecimal to decimal
E6A8
E= 14×16(3) <- = 57344
6= 6×16(2) <- (2) stands for square) = 1536
A= 10×16(1) = 160
8= 8×16 (0) = 8
57344+1536+160+8 = 59048(10) <- (10) stands for square
Extra Hexdecimal to binary
In case you are interested how to covert hex decimal to binary (10011010)
E6 =
E= 14
6 = 6
Take the standard table like explained in my previous tutorial of binary code
(128 64 32 16 8 4 2 1)
We only need 8 4 2 and 1 for both numbers (14 and 6) because it doesn't go higher then 14.
14= 1110
6= 0110
-----------+
11100110
Thank you for reading. I hope you learned something today.
I would like to see your feedback on this tutorial.
Greetings,
Ever wondered how computers can read that #8b0000 is the color dark red?
And why is hex a based 16 system?
Today I want to share my knowledge to make this clearer to you.
RGB
The post you are reading now is made of tiny pixels on your screen (1920x1080) in my case.
Every pixel has a red, green, and blue light (RGB). These colors are added together to produce what your eyes see as 1 color.
Hex
So now we know what RGB stands for and what function it has, lets focus on what Hex does.
Hex is a 6-digit code (#123456) with 3 different parts.
1 = 12 (Red)
2 = 34 (Green)
3 = 56 (Blue)
Hex tells the computer how much to use of each light from the RGB.
The 16-based system
0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F
Hex has a 16-based system so that more than 99 values can be held in 2 digits. Because of this the computer can read more than 16 million combinations.
A stands for 10
B stands for 11
C stands for 12
D stands for 13
E stands for 14
F stands for 15
0 to F (15) = 16
Every digit needs to be multiplied to 16 and be squared to the power of its place.
Example Hexdecimal to decimal
E6A8
E= 14×16(3) <- = 57344
6= 6×16(2) <- (2) stands for square) = 1536
A= 10×16(1) = 160
8= 8×16 (0) = 8
57344+1536+160+8 = 59048(10) <- (10) stands for square
Extra Hexdecimal to binary
In case you are interested how to covert hex decimal to binary (10011010)
E6 =
E= 14
6 = 6
Take the standard table like explained in my previous tutorial of binary code
(128 64 32 16 8 4 2 1)
We only need 8 4 2 and 1 for both numbers (14 and 6) because it doesn't go higher then 14.
14= 1110
6= 0110
-----------+
11100110
Thank you for reading. I hope you learned something today.
I would like to see your feedback on this tutorial.
Greetings,



