Created
January 9, 2015 19:07
-
-
Save usmanity/31369c4e41833ef3de0a to your computer and use it in GitHub Desktop.
colors.js back up for later
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
var getDailyHex = function(){ | |
var d = new Date(); | |
var month = (d.getMonth() + 1).toString(); | |
var day = function(){ if (d.getDate() < 10) { return '0' + d.getDate() } return d.getDate().toString() }; | |
var year = (d.getFullYear() - 2000).toString(); | |
var dailyHex = month + day() + year; | |
return dailyHex; | |
} | |
var getSecondsHex = function(){ | |
var d = new Date(); | |
var hours = function(){ if (d.getHours() < 10) { return '0' + d.getHours() } return d.getHours().toString() }; | |
var minutes = function(){ if (d.getMinutes() < 10) { return '0' + d.getMinutes() } return d.getMinutes().toString() }; | |
var seconds = function(){ if (d.getSeconds() < 10) { return '0' + d.getSeconds() } return d.getSeconds().toString() }; | |
return hours() + minutes() + seconds(); | |
} | |
var updateColors = function(){ | |
var color = '#' + getSecondsHex(); | |
$('body, a, #content #intro, ol li a').css({ | |
'color': color | |
}); | |
} | |
$(document).ready(function(){ | |
window.setInterval(updateColors, 1000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment