Skip to content

Commit 0551409

Browse files
committed
Fixed CI error, made theme persistent
When you reloaded the page in dark mode, it would flash white. This shouldn't happen anymore. Additionally, the no src error should be eliminated.
1 parent 9d07f27 commit 0551409

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

_layouts/default.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<meta name="generator" content="Jekyll v{{ jekyll.version }}">
88

99
<script>
10-
document.addEventListener('DOMContentLoaded', () => {
1110
const m = localStorage.getItem('site_mode') || 'light';
1211
document.documentElement.setAttribute('data-theme', m);
1312
const logo = document.getElementById('site-logo');
@@ -16,7 +15,6 @@
1615
? logo.dataset.dark
1716
: logo.dataset.light;
1817
}
19-
});
2018
</script>
2119

2220
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Open+Sans:400,400italic,600,600italic,700,700italic|Inconsolata:400,700">
@@ -87,11 +85,11 @@ <h1>
8785
</script>
8886
<div class="dark-mode-container mobile-invisible mobile-toggle">
8987
<label class="dark-mode-switch">
90-
<input type="checkbox" id="dark-mode-toggle" />
88+
<input type="checkbox" id="dark-mode-toggle" />
9189
<span class="slider">
92-
<!-- actual image instead of pseudo-element -->
9390
<img
9491
id="dark-mode-icon"
92+
src="/images/sun_black.png"
9593
data-light="/images/sun_black.png"
9694
data-dark="/images/moon_white.png"
9795
alt="mode icon"

0 commit comments

Comments
 (0)