In-page Demo: Click here
Color combination used in a web page is one of the most important ingredient of a good UI. If you get confused, like me, about which color / background-color to use, what can be better than trying out a bunch of random colors.
JavaScript Bookmarklet comes to rescue
Paste the following script in your address bar and press enter (or click Go)
javascript:(function(){var color=’#'+Math.floor(Math.random()*16777215).toString(16);document.body.style.backgroundColor=color;var newDiv=document.createElement(‘div’);newDiv.innerHTML+=color+’;';document.body.appendChild(newDiv);})();
The indented version of the JavaScript code:
(function(){
var color = ‘#’ + Math.floor(Math.random()*16777215).toString(16);
document.body.style.backgroundColor = color;
var newDiv = document.createElement(‘div’);
newDiv.innerHTML += color + ‘;’;
document.body.appendChild(newDiv);
})();
And yeah, once you like a color code, you can check its hex value at the bottom of the page (appended as a div at the bottom).