Skip to content

Add a light/dark toggle to the Qt6 top bar - #1674

Open
dxqb wants to merge 3 commits into
Nerogar:masterfrom
dxqb:qt6-theme-toggle-squashed
Open

Add a light/dark toggle to the Qt6 top bar#1674
dxqb wants to merge 3 commits into
Nerogar:masterfrom
dxqb:qt6-theme-toggle-squashed

Conversation

@dxqb

@dxqb dxqb commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

built on top of @TheForgotten69 's dark mode PR #1488
adds a button to switch between dark and light mode
grafik

AI assistance

  • AI-assisted — I have read every line in this diff and can defend each change

TheForgotten69 and others added 3 commits August 6, 2026 05:48
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants