diff options
| author | Conway <[email protected]> | 2026-05-13 10:48:08 -0400 |
|---|---|---|
| committer | Conway <[email protected]> | 2026-07-08 18:18:56 -0400 |
| commit | 70602dd48c95ea0bf58c51670829361375e9d39a (patch) | |
| tree | ba5bf764af44e1d6deefb2e845487048af3edfd1 /src | |
| parent | c5d6fd1b35d5f5cc75595706ee87ef1f8495d972 (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')
| -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); |
