feat(dashboard): add light/dark theme with sidebar toggle #81
Reference in New Issue
Block a user
Delete Branch "feat/light-mode-theme-toggle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
localStorage.prefers-color-scheme. No JS needed on first paint — the media query covers it, so no flash.<html data-theme="light|dark">) wins over the OS pref.How it works
:rootkeeps the dark tokens.:root[data-theme="light"]overrides them with light tokens. A@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { … } }block applies the same light tokens when the user has made no explicit choice.components/theme_toggle.rsis a tiny Dioxus component. On mount it readslocalStorage; if an explicit value is stored it applies it to the DOM to avoid an OS-vs-stored mismatch flash. On click it flips the value and writes both the DOM attribute andlocalStorage. Allweb_syscalls are gated behind#[cfg(feature = "web")]so the server build stays clean..code-block, graph stabilization overlay) get explicit light-mode overrides so they don't render as dark patches on white.web-sysfeature list extended withStorage,MediaQueryList,Elementso the toggle can do its job.Test plan
localStorage["compliance-scanner.theme"] === "dark",<html data-theme="dark">..code-blockin light mode: code block has light bg, dark text.🤖 Generated with Claude Code