From 7d7f26ed698c6b445099ee8766b8f2b48974b7f3 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sun, 29 Mar 2026 23:51:17 +0800 Subject: [PATCH] fix a bug that switching from dark mode to light mode didn't work on Windows --- src/slic3r/GUI/GUI_App.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index c04e52f1ec..8fd8dd30a0 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3645,9 +3645,15 @@ bool GUI_App::dark_mode() // proper dark mode was first introduced. return wxPlatformInfo::Get().CheckOSVersion(10, 14) && mac_dark_mode(); #else - return wxGetApp().app_config->get("dark_color_mode") == "1" ? true : check_dark_mode(); - //const unsigned luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - //return luma < 128; + // When the user has explicitly chosen a mode, honour it directly. + // Falling through to check_dark_mode() for an explicit "0" would query + // wxSystemSettings::GetAppearance().IsDark(), which is contaminated by + // wxWidgets 3.3's MSWEnableDarkMode(DarkMode_Auto) and can return true + // even though the user asked for light mode. + const auto &val = wxGetApp().app_config->get("dark_color_mode"); + if (val == "1") return true; + if (val == "0") return false; + return check_dark_mode(); #endif #else //BBS disable DarkUI mode