From a3f3d19ad6b61e79be4e62a34af4d1912bc940d3 Mon Sep 17 00:00:00 2001 From: Conway Date: Wed, 13 May 2026 10:48:08 -0400 Subject: KItemListWidget: bump selection alpha and use Active palette group MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Selection background was 0.32 alpha of QPalette::Highlight resolved against the widget's current palette group. On dark color schemes the Inactive group sources Highlight from Colors:Window (per KColorScheme's ChangeSelectionColor effect), so a near-black Window at 0.32 alpha leaves the selection nearly invisible. Force the Active group so the scheme's Selection color is used, and raise the alphas (selected 0.32 → 0.70, selected+hovered 0.40 → 0.85, hover-only 0.06 → 0.12) for adequate contrast on all-dark themes. Co-Authored-By: Claude Opus 4.7 --- src/kitemviews/kitemlistwidget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/kitemviews/kitemlistwidget.cpp') diff --git a/src/kitemviews/kitemlistwidget.cpp b/src/kitemviews/kitemlistwidget.cpp index 32118c569..2d94c4303 100644 --- a/src/kitemviews/kitemlistwidget.cpp +++ b/src/kitemviews/kitemlistwidget.cpp @@ -634,18 +634,18 @@ void KItemListWidget::drawItemStyleOption(QPainter *painter, QWidget *widget, QS // TODO: Remove this check after Plasma 6.8 release // See: https://invent.kde.org/plasma/breeze/-/merge_requests/595 if (style()->name() == QStringLiteral("breeze")) { - QColor backgroundColor{widget->palette().color(QPalette::Highlight)}; + QColor backgroundColor{widget->palette().color(QPalette::Active, QPalette::Highlight)}; backgroundColor.setAlphaF(0.0); if (m_clickHighlighted) { backgroundColor.setAlphaF(1.0); } else { if (m_selected && m_hovered) { - backgroundColor.setAlphaF(0.40); + backgroundColor.setAlphaF(0.85); } else if (m_selected) { - backgroundColor.setAlphaF(0.32); + backgroundColor.setAlphaF(0.70); } else if (m_hovered) { backgroundColor = widget->palette().color(QPalette::Text); - backgroundColor.setAlphaF(0.06); + backgroundColor.setAlphaF(0.12); } } painter->setRenderHint(QPainter::Antialiasing); @@ -658,7 +658,7 @@ void KItemListWidget::drawItemStyleOption(QPainter *painter, QWidget *widget, QS // Focus decoration if (current) { - QColor focusColor{widget->palette().color(QPalette::Highlight)}; + QColor focusColor{widget->palette().color(QPalette::Active, QPalette::Highlight)}; // Set the pen color lighter or darker depending on background color focusColor = m_styleOption.palette.color(QPalette::Base).lightnessF() > 0.5 ? focusColor.darker(110) : focusColor.lighter(110); focusColor.setAlphaF(m_selected || m_hovered ? 1.0 : 0.8); -- cgit v1.3.1