Skip to content

Instantly share code, notes, and snippets.

@josecarlosqs
Created November 17, 2015 20:00
Show Gist options
  • Save josecarlosqs/96da2576aa9938e007bd to your computer and use it in GitHub Desktop.
Save josecarlosqs/96da2576aa9938e007bd to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Gamma de colores</title>
<style>
table{
width: 100%;
}
td{
padding:1px;
width: 100%;
}
</style>
</head>
<body>
<table id="oli" cellspacing="0">
</table>
<script>
var completar = function(str){
var f = "#";
for(var j = str.length; j < 6; j++){
f += "0";
}
return f+""+str;
}
var tabla = document.getElementById("oli");
for(var i = 16777215; i > 0;i-=400){
console.log(i);
var fila = tabla.insertRow();
var k = fila.insertCell();
k.style.backgroundColor = completar(i.toString(16));
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment