GUI: fix light background at startup on light-mode systems#22
Merged
Conversation
egui follows the system light/dark theme by default and keeps separate visuals slots per mode; set_visuals only writes the active slot. On light-mode systems (seen on Windows) the app started with egui's stock light visuals until the first theme cycle rewrote the now-active slot. Pin ThemePreference::Dark and fill both slots with the rtrax palette.
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.
On Windows (or any OS in light mode) the app started with egui's stock light visuals — pattern area and panels light — until the user cycled the theme, which then looked correct.
Cause: egui follows the system light/dark preference by default and keeps two visuals slots.
apply_themeusedctx.set_visuals, which writes only the currently active slot. At startup that was the dark slot; once winit delivered the system's light preference, egui switched to the light slot containing its stock visuals. Cycling the theme re-ranapply_themeagainst the now-active light slot, masking the bug.Fix:
apply_themenow pinsThemePreference::Darkand writes the rtrax palette into both slots viaset_visuals_of, so the OS preference can no longer surface un-themed visuals. rtrax themes fully own the palette; OS light/dark isn't a meaningful input here.Verified on macOS (no regression); needs a quick launch on the light-mode Windows machine to confirm the startup background is now dark.