Created
May 12, 2016 12:19
-
-
Save borgateo/9e6b382337810455735bb63db248d8ad to your computer and use it in GitHub Desktop.
Hex random colors
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Math.floor(Math.random() * 16777215).toString(16)</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var r = Math.random; | |
var c = document.createElement('canvas'); | |
var w = window.innerWidth; | |
var h = window.innerHeight; | |
var t = c.getContext('2d'); | |
c.width = w; c.height = h; | |
var color; | |
document.body.appendChild( c ); | |
setInterval( function() { | |
color = Math.floor( r() * 16777215 ).toString( 16 ); | |
t.fillStyle = '#' + color; | |
t.fillRect( 0, 0, w, h ); | |
}, 1000); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment