Skip to content

Instantly share code, notes, and snippets.

@benfoxall
Created April 19, 2016 10:33
Show Gist options
  • Save benfoxall/3b688331d9a293031de8cb259aa13b44 to your computer and use it in GitHub Desktop.
Save benfoxall/3b688331d9a293031de8cb259aa13b44 to your computer and use it in GitHub Desktop.
// http://colorbrewer2.org/
var colours = [[158,1,66], [213,62,79], [244,109,67],
[253,174,97], [254,224,139], [230,245,152],
[171,221,164], [102,194,165], [50,136,189],
[94,79,162]]
function rgba(color, alpha) {
return 'rgba(' + color.concat(alpha).join(', ') + ')'
}
var i = parseInt(id, 10)
document.body.style.backgroundColor = rgba(colours[i % (colours.length - 1)], 0.3)
document.body.style.backgroundColor = rgba(colours[i % (colours.length - 1)], 0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment