Add a light/dark toggle to the Qt6 top bar - #1674
Open
dxqb wants to merge 3 commits into
Open
Conversation
Fusion derives a complete palette from the OS color scheme, so dark mode needs no colors of its own: it is enough not to force the light palette when Windows reports dark. Other platforms stay pinned to light. Moves the theme code out of create_application into modules/util/ui/theme.py. Rebased onto master by dxqb: the theme block now lives in create_application rather than train_ui_qt.py's main(), and _BASE_STYLESHEET carries master's QToolButton rules. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The dark path is only reachable when Windows reports a dark color scheme, so reviewers on a light-only system cannot see it. OT_FORCE_DARK=1 makes Qt report dark before any widget is built. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apply_theme() takes an explicit `dark` argument; called without it the color scheme still comes from the OS as before. A square button in the top bar flips it at runtime. The call re-applies the stylesheet, which re-polishes existing widgets. Without that, a runtime switch only repaints what draws straight from the application palette, and widgets such as the tabs keep the palette they were polished with. A scheme change regenerates only the palette roles nobody set explicitly, so the white Base written for light mode would otherwise survive into dark. Both schemes' palettes are captured before the first override, and each theme is applied from that pristine copy. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
built on top of @TheForgotten69 's dark mode PR #1488

adds a button to switch between dark and light mode
AI assistance