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
This commit is contained in:
vicrodh committed 2026-06-20 15:49:49 -06:00
1 parent 09cb284b0f
commit c5aec4e1ac
3 files changed
+20 -11

No files matched your search

@@ -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;
@@ -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);
}
@@ -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;