feat(a11y): tokenize Toast icon colors to semantic tokens

Replace the hardcoded per-kind icon hex (#4CAF50/#ff6b6b/#FFA726) with
Theme.success/danger/warning so the toast tint is themeable; buffering
and info keep Theme.accent. The per-kind icon already carries the
non-color cue (WCAG 1.4.1) -- this only guarantees contrast in the a11y
palettes while staying visually neutral in the 31 standard themes.

cc
This commit is contained in:
vicrodh committed 2026-06-20 15:49:37 -06:00
1 parent f72e70bfcb
commit 2ef299caa0
1 file changed
+7 -4
+7 -4
View File
@@ -28,11 +28,14 @@ export component Toast inherits Rectangle {
: root.kind == ToastKind.buffering ? @image-url("../assets/icons/loader-circle.svg")
: @image-url("../assets/icons/info.svg");
// Per-kind accent, matching Tauri's colors.
// Per-kind accent, themed via the semantic tokens. The per-kind icon
// (success check / error alert / warning triangle) already carries the
// non-color cue for WCAG 1.4.1; this just makes the tint themeable so it
// stays high-contrast in the a11y palettes. buffering/info keep accent.
property <color> icon-color:
root.kind == ToastKind.success ? #4CAF50
: root.kind == ToastKind.error ? #ff6b6b
: root.kind == ToastKind.warning ? #FFA726
root.kind == ToastKind.success ? Theme.success
: root.kind == ToastKind.error ? Theme.danger
: root.kind == ToastKind.warning ? Theme.warning
: Theme.accent;
toast := Rectangle {