Skip to content

Commit 31ffdc5

Browse files
Dark mode support.
1 parent b8ff8a9 commit 31ffdc5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

github-game-of-life.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// GitHub Game of Life - 1.0.1
1+
// GitHub Game of Life - 1.0.2
22
// Chris Johnson
33
// @defaced / defaced.dev / github.com/workeffortwaste
44
(function () {
@@ -47,7 +47,11 @@
4747
for (let i = 0; i < contributions.length; i++) {
4848
const days = contributions[i].getElementsByTagName('rect')
4949
for (let d = 0; d < 7; d++) { // Magic number - 7 days of the week.
50-
try { days[d].setAttribute('fill', nextGenerationArray[i][d] ? '#40c463' : '#ebedf0') } catch {}
50+
if (document.getElementsByTagName('html')[0].getAttribute('data-color-mode') === 'dark') {
51+
try { days[d].setAttribute('fill', nextGenerationArray[i][d] ? '#40c463' : '#161b22') } catch {}
52+
} else {
53+
try { days[d].setAttribute('fill', nextGenerationArray[i][d] ? '#40c463' : '#ebedf0') } catch {}
54+
}
5155
}
5256
}
5357
}

manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "GitHub Game of Life",
33
"description": "Replace the GitHub contributions graph with Conway's Game of Life.",
4-
"version": "1.0.1",
4+
"version": "1.0.2",
55
"icons": {
66
"16": "icon16.png",
77
"48": "icon48.png",

0 commit comments

Comments
 (0)