@@ -56,7 +56,7 @@ function fetchGithubContributionsGraphQL(userName, githubToken) {
5656 contributionCalendar {
5757 weeks {
5858 contributionDays {
59- color
59+ contributionLevel
6060 contributionCount
6161 }
6262 }
@@ -84,18 +84,22 @@ function fetchGithubContributionsGraphQL(userName, githubToken) {
8484 }
8585 // Format the contribution days into a 2D array of objects (weeks x days)
8686 const weeks = json . data . user . contributionsCollection . contributionCalendar . weeks ;
87- const colors = [ ] ;
87+ const levels = [ ] ;
8888 for ( let c = 0 ; c < weeks . length ; c ++ ) {
89- colors [ c ] = [ ] ;
89+ levels [ c ] = [ ] ;
9090 const days = weeks [ c ] . contributionDays ;
9191 for ( let r = 0 ; r < days . length ; r ++ ) {
92- colors [ c ] [ r ] = {
93- color : days [ r ] . color ,
92+ levels [ c ] [ r ] = {
93+ level : ( days [ r ] . contributionLevel === "FOURTH_QUARTILE" && 4 ) ||
94+ ( days [ r ] . contributionLevel === "THIRD_QUARTILE" && 3 ) ||
95+ ( days [ r ] . contributionLevel === "SECOND_QUARTILE" && 2 ) ||
96+ ( days [ r ] . contributionLevel === "FIRST_QUARTILE" && 1 ) ||
97+ 0 ,
9498 contributionCount : days [ r ] . contributionCount ,
9599 } ;
96100 }
97101 }
98- return colors ;
102+ return levels ;
99103 } ) ;
100104}
101105/**
@@ -261,11 +265,10 @@ function generateSVG(username_1, githubToken_1) {
261265 const day = ( colorDays [ c ] && colorDays [ c ] [ r ] ) || null ;
262266 if ( ! day )
263267 continue ; // skip bricks for missing days
264- let dayColorIndex = GITHUB_LIGHT . indexOf ( day . color . toLowerCase ( ) ) ;
265268 bricks . push ( {
266269 x : c * ( BRICK_SIZE + BRICK_GAP ) + PADDING ,
267270 y : r * ( BRICK_SIZE + BRICK_GAP ) + PADDING ,
268- colorClass : dayColorIndex !== - 1 ? `c${ dayColorIndex } ` : "c0" ,
271+ colorClass : `c${ day . level } ` ,
269272 status : "visible" ,
270273 hasCommit : day . contributionCount > 0 ,
271274 } ) ;
0 commit comments