How do I convert a RGB colour value to just plain decimal?
So I have: RGB(255,255,255) is white
Its decimal equivalent is: 16777215
I have tried thinking it
You need to left-shift the R by 16, the G left by 8 and or both in to the B. Look at the values as bits and all will become clear:
R 255 = 11111111B G 255 = 11111111B B 255 = 11111111B
Shift R 16: 111111110000000000000000 Shift G 8: 000000001111111100000000
or into B: 111111111111111111111111
Convert to decimal: 16777215