Use wxSystemAppearance::IsDark() to check for dark mode in wxOSX

This should be more reliable than simply checking the red component of
the default window background colour.
This commit is contained in:
Vadim Zeitlin
2019-04-18 19:15:23 +02:00
parent 9a9c845289
commit 16af76e542
2 changed files with 5 additions and 13 deletions

View File

@@ -173,11 +173,9 @@ int wxRendererMac::DrawHeaderButton( wxWindow *win,
wxHeaderSortIconType sortArrow,
wxHeaderButtonParams* params )
{
if ( WX_IS_MACOS_AVAILABLE(10, 14) )
{
if ( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).Red() < 128 )
return wxRendererNative::GetGeneric().DrawHeaderButton(win, dc, rect, flags, sortArrow, params);
}
if ( wxSystemSettings::GetAppearance().IsDark() )
return wxRendererNative::GetGeneric().DrawHeaderButton(win, dc, rect, flags, sortArrow, params);
const wxCoord x = rect.x;
const wxCoord y = rect.y;
const wxCoord w = rect.width;
@@ -391,13 +389,7 @@ void wxRendererMac::DrawSplitterSash( wxWindow *win,
if ( win->HasFlag(wxSP_3DSASH) )
{
bool doDraw;
if ( WX_IS_MACOS_AVAILABLE(10, 14) )
doDraw = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).Red() > 128;
else
doDraw = true;
if ( doDraw )
if ( !wxSystemSettings::GetAppearance().IsDark() )
{
HIThemeSplitterDrawInfo drawInfo;
drawInfo.version = 0;

View File

@@ -88,7 +88,7 @@ void wxStatusBarMac::InitColours()
m_textActive = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT);
m_textInactive = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
if ( bg.Red() < 128 )
if ( wxSystemSettings::GetAppearance().IsDark() )
{
// dark mode appearance
m_textActive = wxColour(0xB0, 0xB0, 0xB0);