graphColour

try to take over the world!

  1. // ==UserScript==
  2. // @name graphColour
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://github.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. // target element : ContributionCalendar-day
  12. // attribute to change: fill
  13. // Contributors:
  14. // https://github.com/AlphaPy
  15.  
  16. var elem = document.getElementsByClassName("ContributionCalendar-day");
  17.  
  18. var LEVEL4 = '#216e39';
  19. var LEVEL3 = '#30a14e';
  20. var LEVEL2 = '#40c463';
  21. var LEVEL1 = '#9be9a8';
  22. var LEVEL0 = '#ebedf0';
  23.  
  24. (function() {
  25. 'use strict';
  26.  
  27. // Your code here...
  28. for(var i=0; i<elem.length; i++){
  29. var currElem = elem[i];
  30. var count = parseInt(currElem.getAttribute("data-count"));
  31.  
  32. if (count>=18){
  33. currElem.style.fill = LEVEL4;
  34. }else if (count>=11){
  35. currElem.style.fill = LEVEL3;
  36. }else if (count>=5){
  37. currElem.style.fill = LEVEL2;
  38. }else if (count>=1){
  39. currElem.style.fill = LEVEL1;
  40. }else if (count<1) {
  41. currElem.style.fill = LEVEL0;
  42. }
  43. }
  44.  
  45. for(var x=0; x<elem.length; x++){
  46. var xcurrElem = elem[x];
  47. var xcount = parseInt(xcurrElem.getAttribute("data-level"));
  48.  
  49. if (xcount === 4){
  50. xcurrElem.style.fill = LEVEL4;
  51. }else if (xcount === 3){
  52. xcurrElem.style.fill = LEVEL3;
  53. }else if (xcount === 2){
  54. xcurrElem.style.fill = LEVEL2;
  55. }else if (xcount === 1){
  56. xcurrElem.style.fill = LEVEL1;
  57. }else if (xcount === 0){
  58. xcurrElem.style.fill = LEVEL0;
  59. }
  60. }
  61. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址