Can somebody explain hexadecimal color format? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can somebody explain hexadecimal color format?

I get that each 2 values define a specific spectrum, but how do they exactly quantify the amount of each color?

24th Dec 2016, 3:56 PM
Francisco Macedo
Francisco Macedo - avatar
8 Answers
+ 9
You've known that every 2 number (or I should say Digits) define a specific spectrum. And yes. The first two digits from left is the hexadecimal code for amount of red. Next two digits is for green and ofcourse last two digits is for blue. Every color that you have seen in this word can be described by using 3 main colors. The RGB. Example: White is full of red, full of green, and full of blue. Thats why it is #FFFFFF. And in our language, it is 255 of red, 255 of green, and 255 of blue. Where the 255 number is the maximum amount of the color. As so does in Hexadecimal digits. Every digit of Hex number contain 0 to F. Means 0 to 15 (A=10, B=11, ... F=15). So, to make it simple, just use this formula: (Left digit)*16 + (right digit) == the real number ex: A5 means : (10)*16 + (5) = 160 + 5 = 165. FF means : (15)*16 + (15) = 240 + 15 = 255. So if you want some dark red color for examples, we can add its red number below 255 (the more it near 0, the less color it adds, so it will be darken), green 0, and blue 0. Lets say it is RGB(200, 0, 0). 200 is equal to 12*16 + 8. So it is C8. Then, because 0 is 00, the Hex code is #C80000. Ta-daa... Sorry for my bad english and my poor vocab. And I hope that this will help.
26th Dec 2016, 5:26 PM
Yaputra Jordi
Yaputra Jordi - avatar
+ 3
In RGB color scheme, we denote every color shade as the combination of three primary colors- Red, Green and Blue. So these combinations are numerically represented by both decimal and hexadecimal numbers. Hexadecimal numbering is much like normal decimal base numbering: from 0 to 9 except the fact that from then we count A=10 to F=15 In decimal system, all these primary colors are denoted within a range of (0, 255). All the other shades are represented as the combination of variations in these primary colors. In hexadecimal system, these decimal values are simply converted into hexadecimal form. So, next time when you come across such hash-tagged hexadecimal code, you know what you have to do. Just separate and convert them to decimal. Here's how you can do that. For example, you see a hexadecimal code that is #303F9F. The first thing you must know that the leftmost first two characters denote value of Red, middle two characters indicate the value of Green and remaining two rightmost characters are for Blue. Then, you calculate the decimal values out of these hexadecimal codes like this- Decimal Color Value= (10th place character value)*(16)¹+ (Unit place character value)*(16)° Thus for the above mentioned hex code, the RGB values are- Colors Hexadecimal value Decimal value R 30 48 G 3F 63 B 9F 159 So #000000 indicates all zero value i.e. black, whereas #FFFFFF is white, which means Red,Green and Blue, all the colors have the maximum value of 255. It's that easy! Since the day I knew this, I've never got bored of colors and they are so fun to play with. Try 'em, match 'em, mix 'em, design using them. Happy coloring and coding! Edit: Although this example is where I've calculated the values by myself, most of the times I'm too lazy to do that, thanks to some websites which provide RGB to Hexcode conversion and vice-versa.
26th Dec 2016, 7:29 PM
Gayatri Kindo
Gayatri Kindo - avatar
+ 3
1,2,3,4,5,6,7,8,9,10,11,12, 13,14,15,16=normal numbers 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f = hexadecimal. It is mostly use for colors in CSS, F being more bright, max color or white and 0 being no color, min color or black. You don't have to learn or memoriza all the colors. You can use a color picker if you need to select a color. Something like Colorzilla plugin for Google Chrome will help you. For CSS you can use something like this, #FFF or #ffffff, which is white and you can use either of them. You only can use 3 or 6 digits. 6 digits is more specific color. Eg: #a5b7c8. The Colorzilla will give you this code.
27th Dec 2016, 12:12 AM
Yves Ramos
Yves Ramos - avatar
+ 3
Thanks everyone! very helpful stuff
27th Dec 2016, 6:05 PM
Francisco Macedo
Francisco Macedo - avatar
+ 1
Quiet simple, if you know how works the different number bases... You know decimal ( wich are "human" numbers ), that's 10 base, and know how you read/write them. You probably have an minimal idea of binary ( wich is "computer" numbers ), that's 2 base. Do you know how to read/write them ? Hexadecimal is 16 base, which is more comfortable for human than binary ( shorter so more readable ), and rest logical for computer. Accessory, in between 2 base and 16 base, we also use 8 base named octal, but slightly less human-computer comfortable... So, I could devellop my explanation, but I need to know if that's clear or not, and what you don't need I devellop? ( binary is ok? should I detail decimal working too? )...
24th Dec 2016, 4:32 PM
visph
visph - avatar
+ 1
Hex 00 = 0 (no color) Hex FF = 255 (max color) everything between is just a shade. the pixels on your screen are close enough together that the RGB sub-pixels blend their photons together additively (in contrast pigments are subtractive).
26th Dec 2016, 11:40 AM
Kirk Schafer
Kirk Schafer - avatar
+ 1
uhh... err... I mean World. Not word
26th Dec 2016, 5:29 PM
Yaputra Jordi
Yaputra Jordi - avatar
0
the format is like this : #xxxxxx thé x change between 0 and F .. F is the hex nember and it's mean the max of color .
26th Dec 2016, 5:53 PM
Ais Amir
Ais Amir - avatar