concatenate 3 HEX values to RGB?

Not open for further replies.
Im trying to concatenate three hex values(redval,greenval,blueval) into a RGB Value(0xFFFFFF) is this possible? I've been trying for a while and it just wont work...(i already googled for help and still couldn't find anyone who has successfully done it.
okay so here is what i have.

I have three potentiometer each with a integer variable(redval,greenval,blueval) with a value between 0-255.
What i want to do is turn these three variables into a color code( ie. 0x00FF00 or 0xFFFFFF) that is represented by the potentiometers.

Does that explain it better?
I would imagine:

unsigned long color_code;
// ...
color_code = ((((unsigned long)(redval & 0xff)) << 16)
	      | (((unsigned long)(greenval & 0xff)) << 8)
	      | ((unsigned long)(blueval & 0xff)));
Not open for further replies.