88
rated 0 times
[
90]
[
2]
/ answers: 1 / hits: 77169
/ 12 Years ago, wed, april 4, 2012, 12:00:00
I am trying to randomly generate a color in hex in javascript.
However the colors generated are almost indistinguishable from eachother.
Is there a way to improve it?
Here is the code I am using:
function randomColor(){
var allowed = "ABCDEF0123456789", S = "#";
while(S.length < 7){
S += allowed.charAt(Math.floor((Math.random()*16)+1));
}
return S;
}
I heard something about HSL and HSV color model but can't get
it to work in my code.
More From » jquery