Implement IsDarkTheme for GTK

This commit is contained in:
Jon Evans 2020-10-10 14:45:06 -04:00
parent 04c4012ee6
commit 14c2937fc3
1 changed files with 10 additions and 3 deletions

View File

@ -21,13 +21,20 @@
#include <kiplatform/ui.h>
#include <wx/nonownedwnd.h>
#include <wx/settings.h>
#include <wx/window.h>
bool KIPLATFORM::UI::IsDarkTheme()
{
// TODO(ISM): Write this function
return false;
wxColour bg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
// Weighted W3C formula
double brightness = ( bg.Red() / 255.0 ) * 0.299 +
( bg.Green() / 255.0 ) * 0.587 +
( bg.Blue() / 255.0 ) * 0.117;
return brightness < 0.5;
}
@ -60,4 +67,4 @@ bool KIPLATFORM::UI::IsStockCursorOk( wxStockCursor aCursor )
default:
return false;
}
}
}