Skip to content

Instantly share code, notes, and snippets.

@oscarmorrison
Created April 23, 2015 00:08
Show Gist options
  • Save oscarmorrison/084411e505dc36f0ba52 to your computer and use it in GitHub Desktop.
Save oscarmorrison/084411e505dc36f0ba52 to your computer and use it in GitHub Desktop.
Creates a shade of blue over supplied range
var numbers = [] //Array of numbers
var range = 100 // Maximum number
for (var i = 0; i < range; i++) {
numbers.push(Math.round(Math.random()*range));
}
blue_color_shade = function (range,number) {
var ratio = 255/range;
var shade = Math.round(number*ratio).toString(16)
if (shade.length==1){shade = "0"+shade};
return "#0000"+shade;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment