Why use Hex Code to color stuff?

Why use hex code when you can use RGB?

I mean it’s useful, but how do you decode all the letters in numbers in there?
The only thing I’ve decoded in hex code is that “00” is no color and “FF” means that it’s the maximum of that color. There are three sections in the six digits, two for each color, but things like “1E” and stuff… i don’t know what they mean.

I recommend checking out this tutorial on numbering systems which covers base 10, 2 (binary) and 16 (hex)


Interesting question actually. Although there is no right and wrong in using RGB or HEX, they do, however, have benefits in their way. I will point a few for each one, so you can see why one may be used over the other.

With RGB

  • If you know the RGB concept (colour light, colour values), then you would know how much each colour (red, green, blue) were used.

  • The other developer/designer with the good RGB colours knowledge will get a decent idea of what colour it is when seeing the RGB values, without having to look it up on the colour wheel

  • Then there is a rgba() function, which includes setting the opacity value for the defined colour, which is handy.

With HEX

It is shorter to write, read, and memorise. While it may not matter to us creators as we can just copy and paste the RGB values and we would know what colour they are.

But, if another developer/designer were working on your code, even with good RGB knowledge, it is longer to read and harder to remember what colour is it, especially if you include so many colours. Thus, Hex comes in useful for that. After all, if a developer has no clue how the colour values work for either HEX or RGB, it wouldn’t have an impact on how these numbers/letters work.

Hope this helps with your first question :slight_smile: