Skip to content

Instantly share code, notes, and snippets.

@noeldelgado
Last active March 8, 2020 23:05

Revisions

  1. noeldelgado revised this gist Mar 8, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion github-graph-colours-changer.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    var GH = ['#EEEEEE', '#D6E685', '#8CC665', '#44A340', '#1E6823'];
    // var GH = ['#EEEEEE', '#D6E685', '#8CC665', '#44A340', '#1E6823']; /* previous GH colors */
    var GH = ['#EBEDF0', '#C6E48B', '#7BC96F', '#239A3B', '#196127'];
    var CO = ['#EF4B4D', '#F89B47', '#FAEA20', '#7DC242', '#5D94CE', '#855CA7'];

    var graph = document.getElementsByClassName('js-calendar-graph-svg')[0];
  2. noeldelgado renamed this gist Jun 26, 2015. 1 changed file with 0 additions and 0 deletions.
  3. noeldelgado renamed this gist Jun 26, 2015. 1 changed file with 0 additions and 0 deletions.
  4. noeldelgado created this gist Jun 26, 2015.
    15 changes: 15 additions & 0 deletions Guthub Graph Colours Changer
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    var GH = ['#EEEEEE', '#D6E685', '#8CC665', '#44A340', '#1E6823'];
    var CO = ['#EF4B4D', '#F89B47', '#FAEA20', '#7DC242', '#5D94CE', '#855CA7'];

    var graph = document.getElementsByClassName('js-calendar-graph-svg')[0];
    var days = [].slice.call(graph.getElementsByTagName('rect'), 0);

    days.forEach(function(rect) {
    switch(rect.getAttribute('fill').toUpperCase()) {
    case GH[0]: rect.setAttribute('fill', CO[2]); break; // yellow
    case GH[1]: rect.setAttribute('fill', CO[Math.floor(Math.random() * 2)]); break; // red || orange
    case GH[2]: rect.setAttribute('fill', CO[3]); break; // green
    case GH[3]: rect.setAttribute('fill', CO[4]); break; // blue
    case GH[4]: rect.setAttribute('fill', CO[5]); break; // purple
    }
    });