Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The first thing you need to know about hex codes is that they aren’t based on ten digits (0 to 9) – they’re based on 16 digits (0 to F). Here’s how hex digits work:
So if you see a hex number like B, you know that just means 11. But, what does BB, or E1, or FF mean? Let’s disassemble a hex color and see what it actually represents. In fact, here’s how you can do that for any hex color you might encounter.
Step one:
Separate the hex color into its three components.
Remember that each hex color is made up of a red, green and blue component. The first thing you want to do is separate those.
Step two:
Convert each hex number into its decimal equivalent.
Now that you have the components separated you can compute the value for each from 0 to 255. Let’s start with the hex number for the red component: