The default Flash IDE palette is 216 colors, which constitute the web-safe palette. If it's of any help, the web-safe palette assigns R, G, and B each one of the following decimal values:
0
51
102
153
204
255

Convert each value to hexadecimal and create all the possible combinations of three of those values, and you'd have the full list. Something like:
possibleColors = new Array (0,51,102,153,204,255);
hexColors = new Array();
for (i=0; i<possibleColors.length; i++){
        hexColors[i]=hex equivalent of possibleColors[i]; // mock code
}
webSafePalette = new Array();
for (r=0; r<hexColors.length; r++){
set webSafePalette[i] value to hexColors[i], or to "#" plus hexColors[i]
        for (g=0; g<hexColors.length; g++){
concatenate hexColors[g] to webSafePalette[i] string; // mock code
        }
        for (b=0; b<hexColors.length; b++){
concatenate hexColors[b] to webSafePalette[i] string; // mock code
        }
}

By this process of concatenating each value for the webSafePalette array, you'd now have the full array.

Note this is untested and in some cases is mock code.

Of course the list of web-safe colors probably exists in a million places on the web, so it might be faster just to nab it and clean it up as needed. But the above code would let you generate as many colors as you wish, by modifying the possibleColors array.

Marc

At 10:56 AM 8/22/2006, you wrote:
Anyone have a function that returns an array of the hex color values for
a particular range (i.e., say the 144 hex colors you see in the Flash
IDE's color picker)?  Or know how to write one?  I'm not looking for a
complete color picker class or component, I'm creating my own with
specific needs, but to do so, I'm not sure how the hex number math
works.  Don't really want to enter all the values manually.

Thanks.

Jason Merrill
Bank of America
Learning & Organization Effectiveness - Technology Solutions




_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to