Created
January 5, 2020 13:54
-
-
Save ssaurel/4967bcfb0b2497c96c521ece99ef8909 to your computer and use it in GitHub Desktop.
hexaTime function for Hexadecimal Color Clock on the SSaurel's Blog
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 hexaTime() { | |
var date = new Date(); | |
// we convert in the 0 .. 255 range | |
var seconds = parseInt(date.getSeconds() * 255 / 59); | |
var minutes = parseInt(date.getMinutes() * 255 / 59); | |
var hours = parseInt(date.getHours() * 255 / 23); | |
return "#" + toHex(hours) + toHex(minutes) + toHex(seconds); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment