Created
January 14, 2014 18:05
-
-
Save toroidal-code/8422795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rand(min, max) { | |
return parseInt(Math.random() * (max-min+1), 10) + min; | |
} | |
function get_random_color() { | |
var h = rand(1, 360); // color hue between 1 and 360 | |
var s = 58; // saturation 30-100% | |
var l = 32; // lightness 30-70% | |
return 'hsl(' + h + ',' + s + '%,' + l + '%)'; | |
} | |
function changeBackground() { | |
document.body.style.background = get_random_color(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment