Quote:
Originally Posted by Jon
Don't tell me you walk around knowing hex codes for all colours?
What is hex for cyan?
|
rofl @ that, haha. White is always the maximum value in any of the representations, 0xFFFFFF is just another way to write 255 255 255 (0xFF = 255).
Quote:
Originally Posted by Bugsy
I'm not sure exactly what you're trying to do or if this will apply to messagemode but here's a more efficient way of storing RGB values.
PHP Code:
//Sample color values new R = 125; new G = 220; new B = 53; //Variable to store our RGB values new RGB = ( R << 16 ) | ( G << 8 ) | B; //Retrieve individual R, G, & B values from RGB variable R = RGB >> 16; G = ( RGB >> 8 ) & ~0xFF00; B = RGB & ~0xFFFF00;
|
There is a small mistake in your RGB retrieving.
R = (RGB & 0xFF0000) >> 16;
G= (RGB & 0xFF00) >> 8;
B = RGB & 0xFF;
The mistake lies in the use of the bitwise not, as ~0xFF00 is not 0x00FF but 0xFFFF00FF, therefore any error in the encoding would screw things over.