How to know colour corresponding to #00FAC0,#00FF00 etc | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to know colour corresponding to #00FAC0,#00FF00 etc

26th Jun 2017, 3:46 AM
Anubhav Singh
Anubhav Singh - avatar
1 Answer
+ 2
# means that it is a hexadecimal notation for color. All colors on a computer are stored in three bytes; one for red, one for green, and one for blue. Numbers in a computer are all based off of powers of two. That is, 1, 2, 4, 8, 16, 32, et cetera. So, for the binary number 10011, we have 19: because reading it backwards, we have 1, 2, and 16 (because there is a zero in the 4 and 8 place. Binary is based off of the powers of two, or is called base two. Hexadecimal, however, is base sixteen. So, we have the numbers 0-9, and then A-F to cover the "ten" digit, "eleven" digit, up until the "fifteens" digit, where it would then roll over to 10 (base 16) = 16 (base 10). Remember how a color has three bytes? One byte is eight 1s or 0s. Therefore, the max value that red (or green or blue) could have is 256. What's that you say? 16 squared is 256? So that's FF in hexadecimal, right? Right! So with a hexadecimal value, let's say #012345, we have 1 in the red value (first two digits), 35 in the green value (middle two), and 69 in the blue value (last two). Remember that in computers we are coloring with light, so #000000 is black and #FFFFFF is white!
26th Jun 2017, 4:11 AM
Keto Z
Keto Z - avatar