feat(ui): Implement theme-aware overlays and fix UI color bugs #16

Merged
Ghost merged 14 commits from fix/stylesheets-overlays-themes into main 2025-11-02 04:48:14 +00:00

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).

  1. Theme-Aware Overlays (Performance, VRAM, Multiplayer)
  • 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.

  1. Adaptive Theme Logic for Dialogs and Overlays
  • 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.

  1. Fix Unreadable Menu Bar Text in Dark Themes
  • 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.

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). 1. Theme-Aware Overlays (Performance, VRAM, Multiplayer) - 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. 2. Adaptive Theme Logic for Dialogs and Overlays - 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. 3. Fix Unreadable Menu Bar Text in Dark Themes - 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.
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Helps change theme to update during emulation.

Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Ghost merged commit 34cdd95f45 into main 2025-11-02 04:48:14 +00:00
Ghost deleted branch fix/stylesheets-overlays-themes 2025-11-02 04:48:15 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Citron/Emulator!16
No description provided.