diff --git a/libs/kiplatform/gtk/ui.cpp b/libs/kiplatform/gtk/ui.cpp index 329b10b772..c14c473abe 100644 --- a/libs/kiplatform/gtk/ui.cpp +++ b/libs/kiplatform/gtk/ui.cpp @@ -21,13 +21,20 @@ #include #include +#include #include 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; } -} \ No newline at end of file +}