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:
3 files changed
+20
-11
No files matched your search
@@ -39,14 +39,14 @@ export component ContextMenuItem inherits Rectangle {
|
|||||||
width: 15px;
|
width: 15px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
tint: root.danger
|
tint: root.danger
|
||||||
? #ef4444
|
? Theme.danger
|
||||||
: (ta.has-hover ? Theme.text-primary : Theme.text-secondary);
|
: (ta.has-hover ? Theme.text-primary : Theme.text-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: root.label;
|
text: root.label;
|
||||||
color: root.danger
|
color: root.danger
|
||||||
? #ef4444
|
? Theme.danger
|
||||||
: (ta.has-hover ? Theme.text-primary : Theme.text-secondary);
|
: (ta.has-hover ? Theme.text-primary : Theme.text-secondary);
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ component BulkButton inherits Rectangle {
|
|||||||
border-radius: Radius.sm;
|
border-radius: Radius.sm;
|
||||||
opacity: root.enabled-when ? 1.0 : 0.4;
|
opacity: root.enabled-when ? 1.0 : 0.4;
|
||||||
background: root.danger
|
background: root.danger
|
||||||
? (ta.has-hover ? #ef444433 : transparent)
|
? (ta.has-hover ? Theme.danger-hover : transparent)
|
||||||
: (ta.has-hover ? Theme.surface-hover : transparent);
|
: (ta.has-hover ? Theme.surface-hover : transparent);
|
||||||
border-width: root.danger ? 1px : 0px;
|
border-width: root.danger ? 1px : 0px;
|
||||||
border-color: #ef4444;
|
border-color: Theme.danger-border;
|
||||||
|
|
||||||
QbzIcon {
|
QbzIcon {
|
||||||
source: root.icon;
|
source: root.icon;
|
||||||
@@ -38,7 +38,7 @@ component BulkButton inherits Rectangle {
|
|||||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||||
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||||
tint: root.danger
|
tint: root.danger
|
||||||
? #ef4444
|
? Theme.danger
|
||||||
: (ta.has-hover ? Theme.text-primary : Theme.text-secondary);
|
: (ta.has-hover ? Theme.text-primary : Theme.text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,14 +114,14 @@ component ArtistRow inherits Rectangle {
|
|||||||
width: 36px;
|
width: 36px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
border-radius: Radius.sm;
|
border-radius: Radius.sm;
|
||||||
background: rm-ta.has-hover ? #ef444426 : transparent;
|
background: rm-ta.has-hover ? Theme.danger-bg : transparent;
|
||||||
QbzIcon {
|
QbzIcon {
|
||||||
source: @image-url("../assets/icons/x.svg");
|
source: @image-url("../assets/icons/x.svg");
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||||
y: Math.round((parent.height - self.height) / 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 {
|
rm-ta := TouchArea {
|
||||||
mouse-cursor: pointer;
|
mouse-cursor: pointer;
|
||||||
@@ -299,7 +299,7 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
width: clear-all-row.preferred-width + 28px;
|
width: clear-all-row.preferred-width + 28px;
|
||||||
height: 34px;
|
height: 34px;
|
||||||
border-radius: Radius.sm;
|
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 {
|
clear-all-row := HorizontalLayout {
|
||||||
x: 14px;
|
x: 14px;
|
||||||
width: self.preferred-width;
|
width: self.preferred-width;
|
||||||
@@ -311,14 +311,14 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
source: @image-url("../assets/icons/trash-2.svg");
|
source: @image-url("../assets/icons/trash-2.svg");
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
tint: #ef4444;
|
tint: Theme.danger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
alignment: center;
|
alignment: center;
|
||||||
Text {
|
Text {
|
||||||
text: @tr("Clear All");
|
text: @tr("Clear All");
|
||||||
color: #ef4444;
|
color: Theme.danger;
|
||||||
font-size: Typography.legal;
|
font-size: Typography.legal;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
@@ -586,7 +586,16 @@ export component BlacklistManagerView inherits Rectangle {
|
|||||||
width: danger-lbl.preferred-width + 32px;
|
width: danger-lbl.preferred-width + 32px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
border-radius: Radius.sm;
|
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 {
|
danger-lbl := Text {
|
||||||
text: @tr("Clear All");
|
text: @tr("Clear All");
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
|||||||
Reference in new issue
Block a user