Created
February 1, 2015 16:05
-
-
Save AllThingsSmitty/0c8db6d08c38a3b60873 to your computer and use it in GitHub Desktop.
Get HSL color value based on time value
This file contains hidden or 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
setInterval(function () { | |
'use strict'; | |
var d = new Date(), | |
h = d.getHours(), | |
m = d.getMinutes(), | |
s = d.getSeconds(); | |
document.body.textContent = [h, m, s].map(function (a) { return a < 10 ? '0' + a : a}).join(':'); | |
document.body.style.background = 'hsl(' + ~~(s * 6) + ', ' + ~~(m * 10/6) + '%, ' + ~~(h * 25/6) + '%)'; | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment