Hex color has always eluded me. Recently I’ve found it necessary to figure it out though. Here’s my best explanation:
A hex color code is made up of 6 numbers and/or letters preceded by a hash sign like this: #A28FF3. Ignore the hash sign, it just tells the computer that it’s a color. Each of the six digits can range from 0 to F. Written from smallest to largest, the range would look like this: 0123456789ABCDEF. That means each digit has a range of 16 different values. A color code can be divided into 3 sections. The first two digits give the intensity of red, the second two are for green and the last two digits for blue. The first digit in a pair describes the intensity of the primary color on a scale from 0 to 16 (or in hex 0 to F), 0 being black, or no color, and 16 being pure red, green or blue. The second digit is the decimal (or hexadecimal I suppose…) and furthers the precision of the first. If you wanted to convert hex to RGB you could multiply the first digit in a pair by 16 then add the second digit to it. For example: #3B0000 would be (3 x 16) + 11 = 59. On a scale from 0 to 255 the intensity of red would be 59. So a computer would look at the intensities of all three pairs and mix the primary colors to display the resultant color.
If you don’t need a lot of accuracy you can actually just drop the second number in a pair. For example, #B7F is the same as writing #B070F0, you just loose some precision. In fact, instead of having over 16 million different color choices, when you use only 3 digits you have about 4,000.