I started with a simple HTML file, called
index.html with this content:
It’s nothing unusual actually, just the basic HTML5 template that IntelliJ IDEA provides, plus a
id set to
clock.js and a CSS stylesheet.
This simple script gets the hours, minutes and seconds, adds them a trailing 0 if the number is only with one digit and sets the background color to this value every second. Nothing special, is it?
You can find the source code on this GitHub repository. Feel free to fork it and change it as you wish.