Skip to content

Instantly share code, notes, and snippets.

@apaatsio
Created January 31, 2013 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apaatsio/4683184 to your computer and use it in GitHub Desktop.
Save apaatsio/4683184 to your computer and use it in GitHub Desktop.
Highlight all DOM elements with a color so it's easy see an overview of the elements at quick glance
var elements = document.querySelectorAll('*');
Array.prototype.slice.call(elements).forEach(function (element) {
var rgba = [Math.floor(Math.random()*256), Math.floor(Math.random()*256), Math.floor(Math.random()*256), 0.1];
element.style.background = 'none';
element.style.backgroundColor = 'rgba(' + rgba.join(',') + ')';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment