You need to look at masking and hexadecimal numbers. The DBP colours are very easy to understand once you see how they work. For example:
myColor = 0xFFFF0000
Would be red. Why? If we take a closer look at that number, we see that we can split it up into an understandable form:
myColor = 0x FF FF 00 00
alpha red green blue
The function rgb() is the "nooby" way of handling colours. The above is exactly the same as this:
myColor = rgb( 255 , 0 , 0 )
In answer to your question, there are 2 ways of getting the individual components. There's the nooby way, and there's the bit masking way.
The nooby way
myColor = rgb( 200 , 80 , 60 )
r = rgbr( myColor )
g = rgbg( myColor )
b = rgbb( mycolor )
Bit masking
You mentioned that you used constants at the beginning of your program. I'm assuming you did something like this:
Alpha = 0xFF000000
Red = 0x00AA0000
Green = 0x0000BB00
Blue = 0x000000CC
And now you want to get all of those together into one variable, right? All we have to do is use bitwise operators:
myColor = Alpha || Red || Green || Blue
MyColor should now have the value 0xFFAABBCC. Note that you can do this in any order you want.
Getting the colours back out of myColor would look like this:
Alpha = myColor && 0xFF000000
Red = myColor && 0x00FF0000
Green = myColor && 0x0000FF00
Blue = myColor && 0x000000FF
You might also want to shift the bits so they do the exact same thing as the rgbr(), rgbg() and rgbb() commands:
Alpha = (myColor && 0xFF000000) >> 24
Red = (myColor && 0x00FF0000) >> 16
Green = (myColor && 0x0000FF00) >> 8
Blue = myColor && 0x000000FF
TheComet
"Why geeks like computers: unzip, strip, touch, finger, grep, mount, fsck, more, yes, fsck, fsck, fsck, umount, sleep." - Unknown