Skip to content

Commit

Permalink
Dark mode support.
Browse files Browse the repository at this point in the history
  • Loading branch information
workeffortwaste committed Dec 10, 2020
1 parent b8ff8a9 commit 31ffdc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions github-game-of-life.js
@@ -1,4 +1,4 @@
// GitHub Game of Life - 1.0.1
// GitHub Game of Life - 1.0.2
// Chris Johnson
// @defaced / defaced.dev / github.com/workeffortwaste
(function () {
Expand Down Expand Up @@ -47,7 +47,11 @@
for (let i = 0; i < contributions.length; i++) {
const days = contributions[i].getElementsByTagName('rect')
for (let d = 0; d < 7; d++) { // Magic number - 7 days of the week.
try { days[d].setAttribute('fill', nextGenerationArray[i][d] ? '#40c463' : '#ebedf0') } catch {}
if (document.getElementsByTagName('html')[0].getAttribute('data-color-mode') === 'dark') {
try { days[d].setAttribute('fill', nextGenerationArray[i][d] ? '#40c463' : '#161b22') } catch {}
} else {
try { days[d].setAttribute('fill', nextGenerationArray[i][d] ? '#40c463' : '#ebedf0') } catch {}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
@@ -1,7 +1,7 @@
{
"name": "GitHub Game of Life",
"description": "Replace the GitHub contributions graph with Conway's Game of Life.",
"version": "1.0.1",
"version": "1.0.2",
"icons": {
"16": "icon16.png",
"48": "icon48.png",
Expand Down

0 comments on commit 31ffdc5

Please sign in to comment.