logo

Petter Envall

Notes
2015
March
19
random-colors

Quick random CSS color from JavaScript

(
  • generate
  • random
  • colors
  • web
  • development
)
2015-03-19
function rndColor() {
    return "hsl(" + ~~(Math.random() * 360) + ", 80%, 60%)";
}

Note: IE8 does not recognize hsl colors.

Click or tap for test: