From 3de5a77028dba37ae0f52e7d2307a99d61d74df0 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Mon, 31 Mar 2025 13:08:27 -0400 Subject: themes/hugo-pt2021/assets/script.js: document theme logic --- themes/hugo-pt2021/assets/script.js | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v1.2.3