diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index b7048155b1..98b557fd3d 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -1479,9 +1479,16 @@ void CClientDlg::SetMixerBoardDeco ( const ERecorderState newRecorderState, cons } else { - if ( palette().color ( QPalette::Window ) == QColor::fromRgbF ( 0.196078, 0.196078, 0.196078, 1 ) ) +#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 ) + // for Qt 6.5.0 or later, we use the inbuilt cross platform color scheme picker. + if ( QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark ) +#else + // for earlier versions, check darkmode as proposed in https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5 + const QPalette defaultPalette; + if ( defaultPalette.color ( QPalette::WindowText ).lightness() > defaultPalette.color ( QPalette::Window ).lightness() ) +#endif { - // Dark mode on macOS/Linux needs a light color + // Dark mode needs a light color sTitleStyle += "color: rgb(220,220,220); }"; } diff --git a/src/clientdlg.h b/src/clientdlg.h index ba01ea648e..378a85c12e 100644 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -42,6 +42,9 @@ #if QT_VERSION >= QT_VERSION_CHECK( 5, 6, 0 ) # include #endif +#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 ) +# include +#endif #include "global.h" #include "util.h" #include "client.h"