Understanding RGB representations

I recently heard someone talk about "html colors", what they meant by it was an rgb hex triplet, prefixed with a hash.

The most common implementation is RGB24 (24-bit RGB), which is also what I'm going to talk about in this article.

It's 24-bit cause it's 3 bytes, one for each of the colors, Red, Green, and Blue.

There's a lot of different numeral systems being used in computer science, hexadecimal, octal, binary, decimal, &c..

R G B notes
FF FF FF hex
255 255 255 decimal

11111111

11111111

11111111

binary

these are all the same, just different numerical systems of representation, and you can easily convert these values using the shell.

hex to decimal

$ printf 'rgb(%d, %d, %d)\n' 0xff 0xff 0xff

decimal to hex

$ printf '#%02x%02x%02x\n' 255 255 255

sometimes you end up using floating values like rgb(0.43, 0.64, 0.31), in which case; you multiply by 255.

But to the main point of this article; stop saying stuff like "rgb or hex?"