Be a Supporter!

RGB hexidecimal variable

  • 200 Views
  • 3 Replies
New Topic Respond to this Topic
cdjproductions
cdjproductions
  • Member since: Jul. 2, 2010
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
RGB hexidecimal variable 2011-07-19 19:21:15 Reply

So, how could I randomize a hexidecimal color code for RGB? Such as the FF0000 (pure red) or 0000FF (pure blue). And after doing that, is there a way to store it as a variable?


This account is now defunct and will now serve as an alt - _)-UltimateCJ64-(_
Seriously, I'm serious.

51lver
51lver
  • Member since: Jan. 14, 2008
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to RGB hexidecimal variable 2011-07-19 19:31:31 Reply

var colour = Math.random()*0xFFFFFF;

Sandremss128
Sandremss128
  • Member since: Aug. 22, 2009
  • Offline.
Forum Stats
Supporter
Level 11
Programmer
Response to RGB hexidecimal variable 2011-07-19 19:40:33 Reply

At 7/19/11 07:31 PM, 51lver wrote: var colour = Math.random()*0xFFFFFF;

var colour:int = int(Math.random() * 0xFFFFFF);

never forget that colour is an int (or uint) variable

cdjproductions
cdjproductions
  • Member since: Jul. 2, 2010
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to RGB hexidecimal variable 2011-07-19 20:12:15 Reply

Ah, that should've been obvious. :P Oh well, thanks guys!


This account is now defunct and will now serve as an alt - _)-UltimateCJ64-(_
Seriously, I'm serious.