Repository navigation
feat(adminpanel): add an automatic theme which follows the system color scheme - #1540
Conversation
…or scheme The theme selector is now a small menu with light, dark and auto. Auto follows prefers-color-scheme of the operating system, also while the page is open, and is the default when no theme was chosen yet. The selection is applied immediately on the client and stored in the existing theme cookie, so the page isn't reloaded anymore and unsaved form input is kept. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011xNc76fa7jSQsMehuCbYQr
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 15 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a13617c79
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The shared project excludes wwwroot/js from its content, so js/theme.js was missing in published builds and the theme didn't change there. Move it to the wwwroot root and use the IIFE style Codacy expects. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011xNc76fa7jSQsMehuCbYQr
Part of #1275 (the admin panel refresh). This one only touches the existing
ThemeSelector, on top of Bootstrap's own color modes (data-bs-theme), asasked there. No new packages, no new override layer.
What changes
Auto (system). The current choice is checked.
prefers-color-schemeof the OS/browser, also while thepage is open (switching the OS to dark mode switches the panel right away).
It's the default when no theme cookie exists yet, so new users get the theme
their system uses. Users who already picked light or dark keep it.
existing
OpenMU.Themecookie. The page is no longer reloaded, sounsaved input in an edit form isn't lost anymore.
js/theme.jsis loaded in<head>before the stylesheets. For"auto" it sets
data-bs-themebefore the first paint, so there's no lightflash for dark-mode users. The server renders
data-theme-preferencewiththe cookie value.
ThemeControllerknowsautonow (and still works as a fallback if the JSmodule can't be loaded). The fallback URL is relative now, so it also works
when the panel is hosted under a path base.
SwitchToDarkMode/SwitchToLightModereplaced byTheme,ThemeLight,ThemeDark,ThemeAuto(en, de, pt-BR, zh-CN).docs-website/docs/admin-panel/overview.md.Screenshots
Before / after (dark):
Light:
Tests
ThemeControllerTests(normalizing, server-side bootstrap theme) andbUnit
ThemeSelectorTests(menu shows three themes with the current onechecked; selecting stores the theme via JS, closes the menu and doesn't
navigate).
dotnet test tests/MUnique.OpenMU.Web.Tests: 721 passed. 1 failure inMapControllerTests.ControllerCreatedAfterDisposalIsDisposedAsync, which isunrelated and timing dependent (passes when run alone, 3 of 3).
dark; picking Light switches without reload and survives a reload; Auto
follows an OS switch live; Esc and clicking outside close the menu; no
console errors.