Skip to content

Instantly share code, notes, and snippets.

@rogeruiz
Created February 14, 2013 16:38
Show Gist options
  • Save rogeruiz/4954071 to your computer and use it in GitHub Desktop.
Save rogeruiz/4954071 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>NEON COLORS</title>
<style>
body {
margin: 0;
padding: 0;
}
#color {
display: block;
min-width: 100%;
min-height: 10000px;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="color"></div>
<script>
var get_random_color = function() {
var color, letters, _r, _i;
letters = '0123456789ABCDEF'.split('');
color = '#';
_i = 0;
_r = 6;
for (_i; _i < _r; _i++ ) {
if (_i > 1){
color += letters[Math.round(Math.random() * 15)];
} else {
color += 'F';
}
}
return color;
};
window.setInterval(function(){
document.getElementById('color').style.backgroundColor = get_random_color();
}, 100);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment