Sunday, March 9, 2008

javascript web safe colors for extjs

Came up with this today when I wanted to popuate an extjs color picker with a set of all web safe colors. I think it's pretty sweet for javascript.

var cl = ['00','33','66','99','CC','FF'];
var clist = [];
for(var x1=0; x1 for(var x2=0; x2 for(var x3=0; x3 clist[clist.length] = cl[x1]+cl[x2]+cl[x3];

You can see the test output here: http://www.rainfireweb.com/drip/testcolor.html

No comments: