JavaScript library to generate random, pretty colors
Limits the random colors in both their saturation and luminance values to avoid overly bright, or overly dull/gray colors |
-
This code will generate a pair of CSS HSL color values for a random hue. The first color element in the returned array is for the darker shade, and the second element is for the lighter shade.
var cPair = rpc.getRandomPrettyColorPair("HSL"); $("DIV").each(function(){ $(this).css({"background-color":cPair[0],"color":cPair[1]}); });