I am no fan of javascript. In fact, I despise it. But, recently, it occured to me that it would be cool to change the CSS theme according to the client's time.
Here's how:
function change_css_according_to_time() {
var d = new Date();
var h = d.getHours();
if ( h >= 7 && h <= 19 ) {
console.log( 'Good day!' );
document.getElementById("mainStyle").href = '/css/default-day.css';
} else {
console.log( 'Good evening!' );
}
}
change_css_according_to_time()
Check out the default.js. It's as simple as that.
Also, you just need the VanillaJS framework: http://vanilla-js.com/.
Have fun!