feat(ui): Implement theme-aware overlays and fix UI color bugs #16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/stylesheets-overlays-themes"
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?
This commit introduces a major refactoring of the theme handling to fix several UI inconsistencies across different application themes and operating system modes (light/dark).
The performance, VRAM, and multiplayer room overlays previously used hardcoded dark theme colors. This caused them to clash visually when the application was set to a light theme.
Each overlay now has an UpdateTheme() slot that sets its colors (background, borders, text) based on whether the application is in a light or dark state.
A global themeChanged() signal was added to GMainWindow, which is now emitted whenever the application theme is changed. All overlays are connected to this signal, allowing them to update their appearance live.
The internal ChatRoom widget within the multiplayer overlay was also made theme-aware to ensure its child controls (text boxes, buttons) adapt correctly.
The logic for determining the theme state was too simplistic, leading to "reverse" theme bugs where selecting an in-app dark theme on a light OS would result in a broken UI.
The IsDarkMode() helper function has been significantly improved. It now correctly prioritizes the user's explicit in-app theme choice over the system theme.
If an adaptive theme ("Default" or "Default Colorful") is selected, the function now correctly falls back to querying the OS palette to determine the light/dark state. This fixes the issue where overlays would appear in light mode when using an adaptive theme on a dark OS.
Dialogs now listen for the QEvent::PaletteChange to update their theme on-the-fly if the OS theme is changed while they are open, preventing a stale UI.
When using a dark OS theme combined with an in-app dark or adaptive theme, the main window's menu bar text ("File", "Emulation", etc.) was nearly invisible.
The issue was caused by the theme stylesheets (.qss files) lacking specific styling for QMenuBar and QMenu.
For the adaptive "Default" theme, adaptive styling using palette() colors was added. This allows the menu bar to correctly derive its text and background colors from the system theme.
For the explicit dark themes (qdarkstyle, etc.), explicit styling rules were added to set a light text color on a dark background, ensuring readability.