From fb19872ab582a44b67dde22ca2144f402db3a75d Mon Sep 17 00:00:00 2001 From: xiokuai Date: Fri, 20 Feb 2026 22:15:48 +0800 Subject: [PATCH 1/2] feat: add theme toggle to settings page Allow users to switch between light/dark/auto themes via localStorage, instead of relying solely on OS prefers-color-scheme. --- forum/templates/base.html | 26 ++++++++++++------------ forum/templates/forum/user_settings.html | 25 +++++++++++++++++++++++ 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/forum/templates/base.html b/forum/templates/base.html index af0c787..190fef9 100644 --- a/forum/templates/base.html +++ b/forum/templates/base.html @@ -8,8 +8,12 @@ @@ -33,10 +37,8 @@ } - @media (prefers-color-scheme: dark) { - body { - background-color: #0d1117; - } + [data-bs-theme="dark"] body { + background-color: #0d1117; } {% block extra_head %}{% endblock %} @@ -107,13 +109,11 @@ diff --git a/forum/templates/forum/user_settings.html b/forum/templates/forum/user_settings.html index 3f4c9fb..0d448f9 100644 --- a/forum/templates/forum/user_settings.html +++ b/forum/templates/forum/user_settings.html @@ -10,6 +10,21 @@ {% block content %}
+
+
+ 主题设置 +
+

选择论坛的显示主题

+
+ + + + + + +
+
+
Web Push 通知 @@ -79,6 +94,16 @@
diff --git a/forum/templates/forum/user_settings.html b/forum/templates/forum/user_settings.html index 0d448f9..3f4c9fb 100644 --- a/forum/templates/forum/user_settings.html +++ b/forum/templates/forum/user_settings.html @@ -10,21 +10,6 @@ {% block content %}
-
-
- 主题设置 -
-

选择论坛的显示主题

-
- - - - - - -
-
-
Web Push 通知 @@ -94,16 +79,6 @@