mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Enable dark mode on windows when built with wx 3.3
This commit is contained in:
parent
1922cab5f4
commit
b83f433506
@ -20,6 +20,7 @@
|
||||
|
||||
#include <kiplatform/app.h>
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/window.h>
|
||||
@ -99,6 +100,10 @@ bool KIPLATFORM::APP::Init()
|
||||
wxLog::SetActiveTarget( new wxLogStderr );
|
||||
}
|
||||
|
||||
#if wxCHECK_VERSION( 3, 3, 0 )
|
||||
wxTheApp->MSWEnableDarkMode();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -30,30 +30,9 @@
|
||||
|
||||
bool KIPLATFORM::UI::IsDarkTheme()
|
||||
{
|
||||
// NOTE: Disabled for now because we can't yet react to dark mode in Windows reasonably:
|
||||
// Windows 10 dark mode does not change the values returned by wxSystemSettings::GetColour()
|
||||
// so our window backgrounds, text colors, etc will stay in "light mode" until either wxWidgets
|
||||
// implements something or we apply a custom theme ourselves.
|
||||
#ifdef NOTYET
|
||||
const wxString lightModeKey = wxT( "AppsUseLightTheme" );
|
||||
|
||||
// Note: registry used because there is not yet an official API for this yet.
|
||||
// This may stop working on future Windows versions
|
||||
wxRegKey themeKey( wxRegKey::HKCU,
|
||||
wxT( "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize" ) );
|
||||
|
||||
if( !themeKey.Exists() )
|
||||
return false;
|
||||
|
||||
if( !themeKey.HasValue( lightModeKey ) )
|
||||
return false;
|
||||
|
||||
long val = 0;
|
||||
|
||||
if( !themeKey.QueryValue( lightModeKey, &val ) )
|
||||
return false;
|
||||
|
||||
return ( val == 0 );
|
||||
#if wxCHECK_VERSION( 3, 3, 0 )
|
||||
wxSystemAppearance appearance = wxSystemSettings::GetAppearance();
|
||||
return appearance.IsDark();
|
||||
#else
|
||||
wxColour bg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user