function randomColor(){
var redColor = Math.floor(Math.random()*100) ;
var blueColor = Math.floor(Math.random()*100);
var yellowColor = Math.floor(Math.random()*100);
if(redColor < 256 && blueColor < 256 && yellowColor < 256){
redColor = redColor.toString(16).length <= 1 ? '0' + redColor.toString(16) : redColor.toString(16);
blueColor = blueColor.toString(16).length <= 1 ? '0' + blueColor.toString(16) : blueColor.toString(16);
yellowColor = yellowColor.toString(16).length <= 1 ? '0' + yellowColor.toString(16) : yellowColor.toString(16);
return "#" + redColor + blueColor + yellowColor;
} else randomColor();
}
|