Skip to content

Instantly share code, notes, and snippets.

@bellalMohamed
Created June 20, 2020 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bellalMohamed/ec9bd7ba6444e35f011e4706034f23bd to your computer and use it in GitHub Desktop.
Save bellalMohamed/ec9bd7ba6444e35f011e4706034f23bd to your computer and use it in GitHub Desktop.
Change Github contributions to rainbow colors
let colors = ["rgba(255, 0, 0, alpha)", "rgba(255, 127, 0, alpha)", "rgba(255, 255, 0, alpha)", "rgba(0, 255, 0, alpha)", "rgba(0, 0, 255, alpha)", "rgba(75, 0, 130, alpha)", "rgba(148, 0, 211, alpha)"];
let alpha = {'#c6e48b': '.5', '#7bc96f': '.7', '#239a3b': '.8', '#7bc96f': '.9', '#196127': '1'}
let days = document.getElementsByClassName('day');
for (var i = 0; i < days.length; i++) {
if (days[i].attributes.fill.value != "#ebedf0") {
let color = colors[i % 7].replace('alpha', alpha[days[i].attributes.fill.value])
days[i].style.fill = color;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment