feat(app-iced): 强调色接线落地(M250 ACCENTWIRE)
appearance.accent_color 此前是死线:配置键、presenter 往返、预设色板都在,但造 tokens 的 唯一入口恒走 DesignTokens::brand(board),用户填了色界面不变。 - theme.rs:Ui::with_accent + accent_scheme(唯一调用 DesignTokens::with_accent 的地方) - app/state/theme.rs:rebuild_ui 三选一(显式强调色 > D38 取色方案 > 出厂板),diag 一行说清是谁生效 - pages/appearance:新增 accent 状态(原文/解析结果/方案/结构化错误)+ 设置页输入行与预设色块; 非法值保持上一次合法值并给出 Short/Long/Digit 三档原因,不静默回退出厂色 - presenter::prefs:AccentChoice::parse 成为唯一解析点,set_accent_checked 交回结构化原因 - app/appearance.rs:persist_appearance 带上 accent_color(此前写不进去),只写上一次合法值 - pages/harness/app.rs:gallery 也能吃 ULL_APPEARANCE_ACCENT,供出图矩阵 - core keys.rs:订正「空 = 出厂 #0078D4;accent 令牌全域生效」这句半真半假的说明 - i18n:强调色 7 条文案(链尾新域,金表只追加) 判据:同一组件(进度条 Primary)在空配置与 #006A5C 下色值不同(App 级 + 令牌级两条); 非法值拿到结构化错误、生效色不回退、不写盘、tokens 仍可构造。
This commit is contained in:
1 parent
4cdb46d2e0
commit
e6b2200360
18 files changed
+787
-38
No files matched your search
@@ -9,6 +9,8 @@
|
||||
//! `Scheme::baseline`(tone 派生)退回它本来的角色——D38 取色链的中性锚点。两条路径并列:
|
||||
//!
|
||||
//! - [`Ui::brand`]:出厂外观,色板自己决定深浅([`BrandBoard::flavor`]);
|
||||
//! - [`Ui::with_accent`]:用户自定义强调色接管 primary/secondary/tertiary 三族(M250),
|
||||
//! 中性表面与 error 保持基线;
|
||||
//! - [`Ui::from_scheme`]:背景图 / 壁纸取色成功时接管 49 个角色(取色失败回落色板);
|
||||
//! - [`Ui::baseline`]:老的 tone 派生口径,只给对照与测试用(产品路径不再默认走它)。
|
||||
//!
|
||||
@@ -124,6 +126,19 @@ impl Ui {
|
||||
}
|
||||
}
|
||||
|
||||
/// 按**用户自定义强调色**求值(M250 ACCENTWIRE):`DesignTokens::with_accent` 的 iced 侧入口。
|
||||
///
|
||||
/// 语义来自 design 的 [`Scheme::from_accent`](既定产品口径,不是缺口):只换
|
||||
/// primary / secondary / tertiary 三族,**中性表面与 error 保持基线**——「换强调色不该让整个
|
||||
/// 窗口底色变脏」。所以拿它跟 [`Ui::new`] 比,Primary 类角色会不同,Surface 系列**不会**。
|
||||
pub fn with_accent(
|
||||
flavor: SchemeFlavor,
|
||||
accent: unlucky_design::color::Color,
|
||||
families: Families,
|
||||
) -> Self {
|
||||
Self::from_scheme(accent_scheme(flavor, accent), families)
|
||||
}
|
||||
|
||||
/// 当前平台(决定字体族与字重降级)。
|
||||
pub fn platform(&self) -> Platform {
|
||||
self.platform
|
||||
@@ -315,6 +330,14 @@ pub fn to_iced(color: unlucky_design::color::Color) -> Color {
|
||||
)
|
||||
}
|
||||
|
||||
/// 强调色 → 49 角色方案:`DesignTokens::with_accent` 的**唯一**调用点(M250)。
|
||||
///
|
||||
/// 放在适配层而不是调用点,是因为「强调色只换三族、中性色保持基线」这条语义属于令牌层;
|
||||
/// 页面侧只该拿到「一套方案」,不该各自决定换哪几个角色。
|
||||
pub fn accent_scheme(flavor: SchemeFlavor, accent: unlucky_design::color::Color) -> Scheme {
|
||||
unlucky_design::DesignTokens::with_accent(flavor, accent).colors
|
||||
}
|
||||
|
||||
/// 令牌字重 → iced 字重。
|
||||
pub fn weight_of(weight: Weight) -> iced::font::Weight {
|
||||
match weight {
|
||||
|
||||
Reference in new issue
Block a user