From c5aec4e1ac8d68d333db444ad788dd83b9a78998 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sat, 20 Jun 2026 15:49:49 -0600 Subject: [PATCH] feat(a11y): tokenize destructive-action colors to Theme.danger family Replace hardcoded danger reds (#ef4444 / #dc2626 / alpha variants) with the Theme danger tokens so destructive affordances follow every theme, including the high-contrast and colorblind palettes (WCAG 1.4.1, P4 #10). - ContextMenuItem: danger row icon tint + label -> Theme.danger. - MultiSelectBar: danger button hover bg -> Theme.danger-hover, border -> Theme.danger-border, icon tint -> Theme.danger. - BlacklistManagerView: per-row remove + Clear-All control + confirm modal danger button -> Theme.danger / danger-bg. The solid-filled confirm button uses Theme.danger.darker(0.12) for hover (mirroring how accent-pressed is derived) instead of Theme.danger-hover, which is a translucent ghost-surface tint and would wash out a filled button (and is lighter in some a11y palettes). These danger surfaces already pair an icon + verb label with color, so color is reinforcement (not the sole signal); no HC-gated borders added here to avoid touching shared button geometry. cc --- .../ui/primitives/ContextMenuItem.slint | 4 ++-- .../ui/primitives/MultiSelectBar.slint | 6 +++--- .../ui/settings/BlacklistManagerView.slint | 21 +++++++++++++------ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/crates/qbz-slint/ui/primitives/ContextMenuItem.slint b/crates/qbz-slint/ui/primitives/ContextMenuItem.slint index 923f4ba63..37188787a 100644 --- a/crates/qbz-slint/ui/primitives/ContextMenuItem.slint +++ b/crates/qbz-slint/ui/primitives/ContextMenuItem.slint @@ -39,14 +39,14 @@ export component ContextMenuItem inherits Rectangle { width: 15px; height: 15px; tint: root.danger - ? #ef4444 + ? Theme.danger : (ta.has-hover ? Theme.text-primary : Theme.text-secondary); } } Text { text: root.label; color: root.danger - ? #ef4444 + ? Theme.danger : (ta.has-hover ? Theme.text-primary : Theme.text-secondary); font-size: 13px; vertical-alignment: center; diff --git a/crates/qbz-slint/ui/primitives/MultiSelectBar.slint b/crates/qbz-slint/ui/primitives/MultiSelectBar.slint index 44e50d1cb..d493f0541 100644 --- a/crates/qbz-slint/ui/primitives/MultiSelectBar.slint +++ b/crates/qbz-slint/ui/primitives/MultiSelectBar.slint @@ -26,10 +26,10 @@ component BulkButton inherits Rectangle { border-radius: Radius.sm; opacity: root.enabled-when ? 1.0 : 0.4; background: root.danger - ? (ta.has-hover ? #ef444433 : transparent) + ? (ta.has-hover ? Theme.danger-hover : transparent) : (ta.has-hover ? Theme.surface-hover : transparent); border-width: root.danger ? 1px : 0px; - border-color: #ef4444; + border-color: Theme.danger-border; QbzIcon { source: root.icon; @@ -38,7 +38,7 @@ component BulkButton inherits Rectangle { x: Math.round((parent.width - self.width) / 2 / 1px) * 1px; y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; tint: root.danger - ? #ef4444 + ? Theme.danger : (ta.has-hover ? Theme.text-primary : Theme.text-secondary); } diff --git a/crates/qbz-slint/ui/settings/BlacklistManagerView.slint b/crates/qbz-slint/ui/settings/BlacklistManagerView.slint index 1da868d1b..de3dc7b8f 100644 --- a/crates/qbz-slint/ui/settings/BlacklistManagerView.slint +++ b/crates/qbz-slint/ui/settings/BlacklistManagerView.slint @@ -114,14 +114,14 @@ component ArtistRow inherits Rectangle { width: 36px; height: 36px; border-radius: Radius.sm; - background: rm-ta.has-hover ? #ef444426 : transparent; + background: rm-ta.has-hover ? Theme.danger-bg : transparent; QbzIcon { source: @image-url("../assets/icons/x.svg"); width: 18px; height: 18px; x: Math.round((parent.width - self.width) / 2 / 1px) * 1px; y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; - tint: rm-ta.has-hover ? #ef4444 : Theme.text-muted; + tint: rm-ta.has-hover ? Theme.danger : Theme.text-muted; } rm-ta := TouchArea { mouse-cursor: pointer; @@ -299,7 +299,7 @@ export component BlacklistManagerView inherits Rectangle { width: clear-all-row.preferred-width + 28px; height: 34px; border-radius: Radius.sm; - background: clear-all-ta.has-hover ? #ef444426 : Theme.surface-elevated; + background: clear-all-ta.has-hover ? Theme.danger-bg : Theme.surface-elevated; clear-all-row := HorizontalLayout { x: 14px; width: self.preferred-width; @@ -311,14 +311,14 @@ export component BlacklistManagerView inherits Rectangle { source: @image-url("../assets/icons/trash-2.svg"); width: 16px; height: 16px; - tint: #ef4444; + tint: Theme.danger; } } VerticalLayout { alignment: center; Text { text: @tr("Clear All"); - color: #ef4444; + color: Theme.danger; font-size: Typography.legal; vertical-alignment: center; } @@ -586,7 +586,16 @@ export component BlacklistManagerView inherits Rectangle { width: danger-lbl.preferred-width + 32px; height: 36px; border-radius: Radius.sm; - background: danger-ta.has-hover ? #dc2626 : #ef4444; + // Solid-filled danger button: base is the theme's + // danger color, hover a derived darker solid shade. + // NOT Theme.danger-hover — that token is a translucent + // hover-tint for ghost/borderless danger surfaces (the + // trash buttons above); using it on a filled button + // would wash the fill out (and is LIGHTER in some a11y + // themes per the migration palette), regressing the + // white label's contrast. .darker() mirrors how + // accent-pressed is derived in theme.slint. + background: danger-ta.has-hover ? Theme.danger.darker(0.12) : Theme.danger; danger-lbl := Text { text: @tr("Clear All"); color: #ffffff;