Created
June 20, 2020 13:51
-
-
Save bellalMohamed/ec9bd7ba6444e35f011e4706034f23bd to your computer and use it in GitHub Desktop.
Change Github contributions to rainbow colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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