From f994e42d8e8a44f6650e976d8f178b8a2cbc622c Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 10 Aug 2022 16:48:37 +0200 Subject: [PATCH] Fix for dark_mode(): Use check_dark_mode() function only, when app_config doesn't have a "dark_color_mode" parameter. Now wxWidgets improved IsDark() function with https://github.com/wxWidgets/wxWidgets/commit/622a2f9d6022d5ca2f1d76e93b2587ac12c2aa82. So now it returns correct color for the system appearance --- src/slic3r/GUI/GUI_App.cpp | 6 +++--- src/slic3r/GUI/GUI_Utils.cpp | 9 --------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 95ef05c45..bb17c3dc0 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1410,9 +1410,9 @@ 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; + if (wxGetApp().app_config->has("dark_color_mode")) + return wxGetApp().app_config->get("dark_color_mode") == "1"; + return check_dark_mode(); #endif } diff --git a/src/slic3r/GUI/GUI_Utils.cpp b/src/slic3r/GUI/GUI_Utils.cpp index 73bfb3bec..d9bffa3f4 100644 --- a/src/slic3r/GUI/GUI_Utils.cpp +++ b/src/slic3r/GUI/GUI_Utils.cpp @@ -153,15 +153,6 @@ wxFont get_default_font_for_dpi(const wxWindow *window, int dpi) } bool check_dark_mode() { -#if 0 //#ifdef _WIN32 // #ysDarkMSW - Allow it when we deside to support the sustem colors for application - wxRegKey rk(wxRegKey::HKCU, - "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"); - if (rk.Exists() && rk.HasValue("AppsUseLightTheme")) { - long value = -1; - rk.QueryValue("AppsUseLightTheme", &value); - return value <= 0; - } -#endif #if wxCHECK_VERSION(3,1,3) return wxSystemSettings::GetAppearance().IsDark(); #else