Skip to content

Instantly share code, notes, and snippets.

@amadden80
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save amadden80/27042d82d9c3a8bab229 to your computer and use it in GitHub Desktop.

Select an option

Save amadden80/27042d82d9c3a8bab229 to your computer and use it in GitHub Desktop.
Messing with NYT
function randomColor() {
red = Math.floor(Math.random()*255);
green = Math.floor(Math.random()*255);
blue = Math.floor(Math.random()*255);
return 'rgb('+red+','+green+','+blue+')';
}
function messingWithArticles(){
var articles = document.body.getElementsByTagName('article');
for (var i=0; i<articles.length; i++){
articles[i].style.color = randomColor();
articles[i].style.backgroundColor = randomColor();
}
}
setInterval(messingWithArticles, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment