faceless - 11 months ago 63

CSS Question

I know that 0 through F represent 0-15, and hex codes are split into 3 groups of two digit hexadecimals, but how is the value 0 through 255 reached with these two digits for R, G, and B?

For example #FF FF FF is #1515 1515 1515, it's displayed as white and equal to R=255, G=255, B=255, but how do two 15's equal 255? Multiplied they're only 225.

Answer Source

Its the number base.

(FF)_16 = 15*16^1 + 15*16^0 = (255)_10

FF are in base 16 while your 255 are in base 10. so you will need to apply base conversion to get the number in the other base.

you may wanna read up more about it from this link