diff options
| author | Paul Duncan <pabs@pablotron.org> | 2025-03-31 11:43:48 -0400 | 
|---|---|---|
| committer | Paul Duncan <pabs@pablotron.org> | 2025-03-31 11:43:48 -0400 | 
| commit | 019b086519a9b6882b797699916232ae391d6496 (patch) | |
| tree | af613a63a115b87bd06bbbfeae05940655c55564 | |
| parent | fa555f7963ba598b05ca0f177e48efcf19b4961f (diff) | |
| download | pablotron.org-019b086519a9b6882b797699916232ae391d6496.tar.xz pablotron.org-019b086519a9b6882b797699916232ae391d6496.zip  | |
themes/hugo-pt2021/assets/script.js: default to dark mode
| -rw-r--r-- | themes/hugo-pt2021/assets/script.js | 9 | 
1 files changed, 5 insertions, 4 deletions
diff --git a/themes/hugo-pt2021/assets/script.js b/themes/hugo-pt2021/assets/script.js index b879f64..f7b3973 100644 --- a/themes/hugo-pt2021/assets/script.js +++ b/themes/hugo-pt2021/assets/script.js @@ -58,10 +58,11 @@ const D = document,  // use theme if set, otherwise fall back to browser preference  // FIXME: move to DOMContentLoaded? -if (L && L.theme && L.theme === 'dark') { -  C.add('dark'); // theme set to "dark" -} else if ((!L || !L.theme) && M && M('(prefers-color-scheme: dark)').matches) { -  C.add('dark'); // prefers dark color scheme +C.add('dark'); // unconditionally set dark mode +if (L && L.theme && L.theme === 'light') { +  C.remove('dark'); // set light theme +} else if ((!L || !L.theme) && M && M('(prefers-color-scheme: light)').matches) { +  C.remove('dark'); // set light theme  }  document.addEventListener('DOMContentLoaded', () => {  | 
