diff --git a/UEFITool/uefitool.cpp b/UEFITool/uefitool.cpp index 4a79155..0522483 100644 --- a/UEFITool/uefitool.cpp +++ b/UEFITool/uefitool.cpp @@ -168,14 +168,23 @@ void UEFITool::init() ui->builderMessagesListWidget->installEventFilter(this); // Switch default window style to Fusion on Qt6 Windows builds - // TODO: remove this once default style gains dark theme support -#if defined Q_OS_WIN and QT_VERSION_MAJOR >= 6 - QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat); - if (settings.value("AppsUseLightTheme", 1).toInt() == 0) { - QApplication::setStyle(QStyleFactory::create("Fusion")); - QApplication::setPalette(QApplication::style()->standardPalette()); + +#if QT_VERSION_MAJOR >= 6 +#if defined Q_OS_OSX + const QPalette palette = QApplication::palette(); + const QColor& color = palette.color(QPalette::Active, QPalette::Base); + if (color.lightness() < 127) { // TreeView has dark background model->setMarkingDarkMode(true); } +#elif defined Q_OS_WIN + QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat); + if (settings.value("AppsUseLightTheme", 1).toInt() == 0) { + model->setMarkingDarkMode(true); + // TODO: remove this once default style gains dark theme support + QApplication::setStyle(QStyleFactory::create("Fusion")); + QApplication::setPalette(QApplication::style()->standardPalette()); + } +#endif #endif } diff --git a/UEFITool/uefitool.h b/UEFITool/uefitool.h index 7c68ab0..5533a3e 100644 --- a/UEFITool/uefitool.h +++ b/UEFITool/uefitool.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include