From 2a32d70144b1f74350de9d9c5022f07c4d3a05b0 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 8 Jun 2026 20:39:37 +1000 Subject: [PATCH] Qt: Fix white-on-light icon colours in Classic Windows theme --- src/duckstation-qt/svgiconengine.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/duckstation-qt/svgiconengine.cpp b/src/duckstation-qt/svgiconengine.cpp index de7c6c305..fba92e278 100644 --- a/src/duckstation-qt/svgiconengine.cpp +++ b/src/duckstation-qt/svgiconengine.cpp @@ -29,25 +29,13 @@ static QColor GetIconColorFromPalette(QIcon::Mode mode, QIcon::State state) // Thank gosh these are copy-on-write... const QPalette palette = QApplication::palette(); - // For the "On" state (e.g., checked icons), use highlight/button colors - if (state == QIcon::On) - { - if (mode == QIcon::Disabled) - return palette.color(QPalette::Disabled, QPalette::ButtonText); - else if (mode == QIcon::Selected) - return palette.color(QPalette::Current, QPalette::HighlightedText); - else - return palette.color(QPalette::Normal, QPalette::ButtonText); - } - + // For the "On" state (e.g., checked icons) // For the "Off" state (normal/unchecked) // NOTE: Active and Normal are the same in QPalette. - if (mode == QIcon::Disabled) - return palette.color(QPalette::Disabled, QPalette::WindowText); - else if (mode == QIcon::Selected) - return palette.color(QPalette::Current, QPalette::HighlightedText); - else - return palette.color(QPalette::Normal, QPalette::WindowText); + const QPalette::ColorGroup cgroup = + (mode == QIcon::Disabled) ? QPalette::Disabled : ((mode == QIcon::Selected) ? QPalette::Current : QPalette::Normal); + const QPalette::ColorRole crole = (state == QIcon::On) ? QPalette::ButtonText : QPalette::WindowText; + return palette.color(cgroup, crole); } /// Constructs a cache key for the given resource path, pixel size, and RGBA color value.