From 019b086519a9b6882b797699916232ae391d6496 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Mon, 31 Mar 2025 11:43:48 -0400 Subject: themes/hugo-pt2021/assets/script.js: default to dark mode --- themes/hugo-pt2021/assets/script.js | 9 +++++---- 1 file 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', () => { -- cgit v1.2.3