Last active
May 3, 2018 22:08
-
-
Save timdorr/897687 to your computer and use it in GitHub Desktop.
Disco mode!
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 disco() { | |
var elements = document.getElementsByTagName('*'); | |
for (var i = elements.length - 1; i >= 0; i--) { | |
var r = Math.floor(Math.random()*256); | |
var g = Math.floor(Math.random()*256); | |
var b = Math.floor(Math.random()*256); | |
elements[i].style.color = '#'+r.toString(16)+g.toString(16)+b.toString(16); | |
var r = Math.floor(Math.random()*256); | |
var g = Math.floor(Math.random()*256); | |
var b = Math.floor(Math.random()*256); | |
elements[i].style.backgroundColor = '#'+r.toString(16)+g.toString(16)+b.toString(16); | |
}; | |
setTimeout(disco, 100); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool stuff 💃 👍