Skip to content

Instantly share code, notes, and snippets.

@timdorr
Last active May 3, 2018 22:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timdorr/897687 to your computer and use it in GitHub Desktop.
Save timdorr/897687 to your computer and use it in GitHub Desktop.
Disco mode!
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);
};
@ArturKy
Copy link

ArturKy commented Jul 15, 2016

cool stuff 💃 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment