diff options
| author | Conway <[email protected]> | 2026-05-13 10:48:08 -0400 |
|---|---|---|
| committer | Conway <[email protected]> | 2026-06-04 17:58:24 -0400 |
| commit | 4efbed4e6ad8bfd672a87afee8fd2c3bcd5f44cc (patch) | |
| tree | 2736c48422f089d8c0ddfaa6a4e5b078ff9616c2 /src/kitemviews | |
| parent | 94f5d3c9c8da4a74b21e2a318920a7642cc1dff5 (diff) | |
KItemListWidget: bump selection alpha and use Active palette group
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 <[email protected]>
Diffstat (limited to 'src/kitemviews')
| -rw-r--r-- | src/kitemviews/kitemlistwidget.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/kitemviews/kitemlistwidget.cpp b/src/kitemviews/kitemlistwidget.cpp index e792844b0..1650ea190 100644 --- a/src/kitemviews/kitemlistwidget.cpp +++ b/src/kitemviews/kitemlistwidget.cpp @@ -640,18 +640,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); @@ -664,7 +664,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); |
