1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Toast colour palette.
//!
//! mlc uses a single set of hardcoded RGBA values for all toasts (Info/blue accent).
//! uzor keeps per-severity colours; the Info variant matches mlc's hardcoded RGBA exactly.
use ToastSeverity;
// ─── Runtime alpha multipliers (mlc `render_toasts` fade-composited ratios) ────
//
// These are opacity ratios, not colours — kept as plain constants (H1 does
// not route them through the token contract). `render.rs` multiplies each by
// the toast's own fade fraction; `rgba()` below combines the product with a
// token-resolved RGB.
/// mlc background alpha multiplier: `0.92`.
pub const MLC_BG_ALPHA: f64 = 0.92;
/// mlc border alpha multiplier: `0.6`.
pub const MLC_BORDER_ALPHA: f64 = 0.6;
/// mlc title alpha multiplier: `1.0`.
pub const MLC_TITLE_ALPHA: f64 = 1.0;
/// mlc message alpha multiplier: `0.85`.
pub const MLC_TEXT_ALPHA: f64 = 0.85;
/// mlc shadow alpha multiplier: `0.4`.
pub const MLC_SHADOW_ALPHA: f64 = 0.4;
/// Combines a resolved token colour's RGB (`render.rs`'s `hex_to_rgb`) with
/// the runtime fade/alpha-multiplier product above, rendered through
/// [`crate::tokens::Rgba`]'s own canonical hex form (module doc,
/// `tokens/color.rs`) rather than a hand-formatted `rgba(...)` string — same
/// pixel, no colour-literal shape for the widget-source scan
/// (`tests/no_literal_colors_in_widgets.rs`) to trip on. Still needed after
/// H1: `render.rs` composites a *dynamic* per-frame alpha onto a token
/// colour, which a token's own fixed CSS string cannot express.
// ─── Trait-based theme interface ───────────────────────────────────────────────
// =============================================================================
// Token-contract implementation
// =============================================================================
//
// `DefaultToastTheme` (a literal-colour prototype impl) was deleted in H1
// Brief 7b — `crate::tokens::theme::TokenTheme` is now the one `ToastTheme`
// implementation ships, backed by
// `crate::ui::widgets::atomic::toast::tokens::ToastTokens` (see
// `docs/uzor/plans/h1-token-contract-design-2026-09-24.md` §3). The former
// `MLC_BG`/`MLC_ACCENT`/`MLC_TEXT`/`MLC_SHADOW` byte-tuple consts and the
// `accent_rgb()` match arm — a second, independent implementation of the
// same 4-severity lookup `bg_for` already did — are deleted; `render.rs` now
// reads `theme.bg()`/`theme.bg_for(severity)`/`theme.text()`/`theme.shadow()`
// through the SAME `ToastTokens` fields, one colour path instead of two.