Make every theme setting reachable and the theme controls effective

With the default settings (follow the system, light grey) the nav's hue slider
and dark toggle did nothing visible, and no UI could leave that mode. The slider
also always wrote the light hue, even in dark mode.

PageSettings gains SetDarkMode, SetGray and SetHue, and CascadingState gains
UpdatePageSettings. They keep the flags consistent:
- choosing light or dark leaves system theming;
- picking a hue leaves grey;
- grey follows the variant shown.
theme.js reports which variant is showing (AppStatusService.IsDarkTheme), so the
nav toggle and slider edit that one, including the OS's choice in system mode.

Settings > General, which was empty, now edits every theme setting:
- follow the system;
- dark mode;
- grey;
- the light and dark hues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
thepraandClaude Opus 5.5 committed 2026-10-03 12:43:07 +02:00
1 parent a097338121
commit 81b92e012b
6 files changed
+94 -44

No files matched your search

+7 -2
View File
@@ -1,7 +1,8 @@
// Applies PageSettings to the page. It picks the daisyUI theme from Styles/theme.css and sets the hue and chroma
// variables that theme derives every colour from. It loads in <head> right after css/app.css and applies the
// settings saved in localStorage before the first paint. Once Blazor runs, CascadingState calls neoTheme.apply
// through AppStatusService.ApplyTheme whenever the settings change.
// through AppStatusService.ApplyTheme whenever the settings change, and the theme controls ask neoTheme.isDark
// (AppStatusService.IsDarkTheme) which variant they are editing.
(() => {
const root = document.documentElement
let current = null
@@ -48,5 +49,9 @@
// With system theming the OS can switch between light and dark at any time.
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => apply(current))
window.neoTheme = { apply }
// Whether the dark variant is showing, chosen or taken from the OS.
const isDark = () => root.getAttribute("data-theme") === "neo-dark" ||
(!root.hasAttribute("data-theme") && window.matchMedia("(prefers-color-scheme: dark)").matches)
window.neoTheme = { apply, isDark }
})()