aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2025-03-31 13:08:27 -0400
committerPaul Duncan <pabs@pablotron.org>2025-03-31 13:08:27 -0400
commit3de5a77028dba37ae0f52e7d2307a99d61d74df0 (patch)
tree2269caa9033218060d71b96ee7dd220f2439338c
parent019b086519a9b6882b797699916232ae391d6496 (diff)
downloadpablotron.org-3de5a77028dba37ae0f52e7d2307a99d61d74df0.tar.xz
pablotron.org-3de5a77028dba37ae0f52e7d2307a99d61d74df0.zip
themes/hugo-pt2021/assets/script.js: document theme logic
-rw-r--r--themes/hugo-pt2021/assets/script.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/themes/hugo-pt2021/assets/script.js b/themes/hugo-pt2021/assets/script.js
index f7b3973..57e5a39 100644
--- a/themes/hugo-pt2021/assets/script.js
+++ b/themes/hugo-pt2021/assets/script.js
@@ -58,6 +58,12 @@ const D = document,
// use theme if set, otherwise fall back to browser preference
// FIXME: move to DOMContentLoaded?
+//
+// update (2025-03-31): prefer dark mode by default and only set light
+// mode if one of the following conditions is true:
+// 1. the user has explicitly set the theme using the navbar button, or
+// 2. the user has not explicitly set the theme but has indicated that
+// they prefer light mode.
C.add('dark'); // unconditionally set dark mode
if (L && L.theme && L.theme === 'light') {
C.remove('dark'); // set light theme