Skip to content

feat: allow enabling dark mode on Linux#11331

Open
BenJule wants to merge 1 commit into
bambulab:masterfrom
BenJule:feat/linux-dark-mode-toggle
Open

feat: allow enabling dark mode on Linux#11331
BenJule wants to merge 1 commit into
bambulab:masterfrom
BenJule:feat/linux-dark-mode-toggle

Conversation

@BenJule

@BenJule BenJule commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

On Linux there's no way to turn on dark mode: the Preferences "Dark Mode" toggle is guarded by #ifdef _WIN32, even though the dark rendering path is compiled on all platforms (SUPPORT_DARK_MODE is defined unconditionally). So Linux users can't enable dark mode from the UI at all.

It's also worse than just a hidden toggle: on non-Windows, GUI_App overwrites dark_color_mode with wxSystemSettings::GetAppearance().IsDark() on every startup. On Linux wxGTK derives that purely from the GTK theme (it doesn't see e.g. KDE's color-scheme: prefer-dark), so even if a user sets the config by hand it gets reset on the next launch.

Changes

  • Show the dark-mode toggle on Linux as well (#ifndef __APPLE__ instead of #ifdef _WIN32). macOS is left out on purpose: there dark_mode() uses the native appearance and ignores this config, so a toggle would do nothing.
  • Seed dark_color_mode from the system appearance on first run only, so a user's explicit choice in Preferences persists across restarts instead of being overwritten every start. On first run the behaviour is unchanged (it still follows the detected system appearance).

This mirrors how the toggle already works on Windows (dark_mode() is config == "1" ? true : check_dark_mode() on both).

Test plan

  • Linux: Preferences now shows "Dark Mode > Enable dark mode"; toggling it and restarting keeps the chosen state instead of snapping back to the GTK-theme-derived default.
  • Windows: unchanged (the toggle and startup seeding behaved this way already).
  • macOS: unchanged (no toggle shown; native appearance still drives dark_mode()).
  • I don't have a Windows/macOS GUI build here, so I verified the preprocessor/flow by tracing the code; the Linux behaviour is the target of this change.

Note: as before, on Linux the live re-theme of native widgets still depends on the GTK theme; a full switch is cleanest after a restart. This PR is about making the option reachable and persistent, which it wasn't.

The Preferences 'Dark Mode' toggle was guarded by #ifdef _WIN32, so Linux users
had no way to turn dark mode on even though the dark rendering path is built on
all platforms (SUPPORT_DARK_MODE). On top of that, on non-Windows the app
overwrote dark_color_mode with the system appearance on every start, which on
Linux follows only the GTK theme (not e.g. KDE's color-scheme) and reset any
manual choice.

- Show the dark-mode toggle on Linux as well (#ifndef __APPLE__; macOS stays on
  the native appearance, where dark_mode() ignores this config).
- Seed dark_color_mode from the system appearance on first run only, so the
  user's explicit choice persists across restarts instead of being overwritten.
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.

1 participant