If you can ignore IE8 and below you can get a random 'light' color in hsl, by randomly changing the hue and setting the saturation to 50% and the light component to 75%.
var lightColor='hsl('+Math.floor(Math.random()*361)+',50%,75%)';
var lightColor= 'hsl('+Math.floor(Math.random()*361)+',50%,75%)';
You can translate hsl color (near enough) to rgb if required for older browsers-
function hslToRgb(hsl){
if(typeof hsl== 'string'){
hsl= hsl.match(/(\d+(\.\d+)?)/g);
}
var sub, h= hsl[0]/360, s= hsl[1]/100, l= hsl[2]/100,
t1, t2, t3, rgb, val;
if(s== 0){
val= Math.round(l*255).minmax(0, 255);
rgb= [val, val, val];
}
else{
if(l<0.5) t2= l*(1 + s);
else t2= l + s - l*s;
t1= 2*l - t2;
rgb= [0, 0, 0];
for(var i= 0; i<3; i++){
t3= h + 1/3*-(i - 1);
t3<0 && t3++;
t3>1 && t3--;
if(6*t3<1) val= t1 +(t2 - t1)*6*t3;
else if(2*t3<1) val= t2;
else if(3*t3<2) val= t1 +(t2 - t1)*(2/3 - t3)*6;
else val= t1;
rgb[i]= Math.round(val*255).minmax(0, 255);
}
}
return 'rgb('+rgb.join(',')+')';
}
lightColor+'~= '+hslToRgb(lightColor);
/* returned value: (String)
hsl(88,50%,75%)~= rgb(193,223,159)
*/