I just learned about this so I wanted to put it there because I find math fascinating on its own, so here we go.
Hexadecimal codes are used all over the internet. In fact for most roleplaying aficionados like myself, we know that a hexadecimal code is what allows us to display millions of shades of color on webpages. Personally, I've always wondered how they work beyond that.
Well, we have a ten number system; a decimal system. We use ten numbers to represent these, which are 0 through 9. We also have a binary system (two number system) for computers, which only uses the numbers 0 through 1. And hexadecimal means sixteen numbers.
I know what you're thinking, assuming you made it this far. "Okay Kyte, anyone with a basic understanding of Latin could have figured that out. What of it?" Well, my very sassy and educated friend, this is what that amounts to.
Binary and decimal are a little different. Because using the numbers 0-9 is natural to us. Hexadecimal systems use something a little different, because for each of these systems, the number goes to 10 at the end. Counting past that would just get confusing. So instead, we use the letters A-F, not unlike the Romans using letters in their numerals, to represent these numbers. So the natural order would be 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, F, and when we go beyond F, that's when we use 10.
That's why you never see the letters G-Z in a hexadecimal code.
So what does this all mean when we apply it to coloring our text?
A hexadecimal code for color is comprised of six digits. And in turn, these six digits are comprised of three separate codes, consisting of two digits each. Each of these three codes, in that particular order, is the amount of red, green, and blue that particular color has. Because of this you can have 256 different amounts of each color for that particular code.
I'll go ahead and use mine as an example. 800000 is actually 80/00/00. This means it has 128 (Remember, each time the dial goes to 10, that means we're actually at 16. So 16 x 8.) parts red, 0 parts green, and 0 parts blue. 00 in a hexadecimal usually means black. That's why that color I use is equal parts red and black.
Hope you enjoyed.