File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3019,11 +3019,18 @@ bool GUI_App::on_init_inner()
30193019 load_language (wxString (), true );
30203020#ifdef _MSW_DARK_MODE
30213021
3022- #ifndef __WINDOWS__
3023- wxSystemAppearance app = wxSystemSettings::GetAppearance ();
3024- GUI::wxGetApp ().app_config ->set (" dark_color_mode" , app.IsDark () ? " 1" : " 0" );
3025- GUI::wxGetApp ().app_config ->save ();
3026- #endif // __APPLE__
3022+ {
3023+ wxSystemAppearance app = wxSystemSettings::GetAppearance ();
3024+ #ifdef __WINDOWS__
3025+ if (app_config->get (" dark_mode_follow_system" ) == " 1" ) {
3026+ app_config->set (" dark_color_mode" , app.IsDark () ? " 1" : " 0" );
3027+ app_config->save ();
3028+ }
3029+ #else
3030+ GUI::wxGetApp ().app_config ->set (" dark_color_mode" , app.IsDark () ? " 1" : " 0" );
3031+ GUI::wxGetApp ().app_config ->save ();
3032+ #endif
3033+ }
30273034
30283035
30293036 bool init_dark_color_mode = dark_mode ();
@@ -3649,7 +3656,9 @@ bool GUI_App::dark_mode()
36493656 // proper dark mode was first introduced.
36503657 return wxPlatformInfo::Get ().CheckOSVersion (10 , 14 ) && mac_dark_mode ();
36513658#else
3652- return wxGetApp ().app_config ->get (" dark_color_mode" ) == " 1" ? true : check_dark_mode ();
3659+ if (wxGetApp ().app_config ->get (" dark_mode_follow_system" ) == " 1" )
3660+ return check_dark_mode ();
3661+ return wxGetApp ().app_config ->get (" dark_color_mode" ) == " 1" ;
36533662 // const unsigned luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
36543663 // return luma < 128;
36553664#endif
Original file line number Diff line number Diff line change @@ -201,12 +201,17 @@ template<class P> class DPIAware : public P
201201
202202 this ->Bind (wxEVT_SYS_COLOUR_CHANGED, [this ](wxSysColourChangedEvent& event)
203203 {
204- #ifndef __WINDOWS__
204+ #ifdef __WINDOWS__
205+ if (GUI::wxGetApp ().app_config &&
206+ GUI::wxGetApp ().app_config ->get (" dark_mode_follow_system" ) == " 1" ) {
205207 update_dark_config ();
206208 on_sys_color_changed ();
207- event.Skip ();
208- #endif // __WINDOWS__
209-
209+ }
210+ #else
211+ update_dark_config ();
212+ on_sys_color_changed ();
213+ #endif
214+ event.Skip ();
210215 });
211216
212217 if (std::is_same<wxDialog, P>::value) {
Original file line number Diff line number Diff line change @@ -2614,10 +2614,8 @@ void MainFrame::on_sys_color_changed()
26142614 // update label colors in respect to the system mode
26152615 wxGetApp ().init_label_colours ();
26162616
2617- #ifndef __WINDOWS__
26182617 wxGetApp ().force_colors_update ();
26192618 wxGetApp ().update_ui_from_settings ();
2620- #endif // __APPLE__
26212619
26222620#ifdef __WXMSW__
26232621 wxGetApp ().UpdateDarkUI (m_tabpanel);
Original file line number Diff line number Diff line change @@ -95,7 +95,8 @@ class PreferencesDialog : public DPIDialog
9595 // debug mode
9696 ::CheckBox * m_developer_mode_ckeckbox = {nullptr };
9797 ::CheckBox * m_internal_developer_mode_ckeckbox = {nullptr };
98- ::CheckBox * m_dark_mode_ckeckbox = {nullptr };
98+ ::CheckBox * m_dark_mode_ckeckbox = {nullptr };
99+ ::CheckBox * m_dark_mode_follow_system_checkbox = {nullptr };
99100 ::TextInput *m_backup_interval_textinput = {nullptr };
100101
101102 wxString m_developer_mode_def;
You can’t perform that action at this time.
0 commit comments