[阶段7] 前端重做:31 项指标全部露出,配色经色盲校验
原来仪表板只有 4 张卡片和 4 张图,31 项指标里绝大多数没有出口。 信息架构重组为 7 个页面(原 5 个): - 今日 按活动 / 心率压力 / 睡眠呼吸三组展示 16 项指标 - 趋势 15 组指标可切换,5 档时间窗口(最长一年) - 睡眠 新增。分期堆叠图 + 夜间血氧/呼吸/压力 - 成就 新增。奖励徽章按年份分组、个人纪录、运动记录 - 建议 / 同步 / 设置 保持 配色(依据 dataviz 规范,用校验器实测而非目测): - 采用验证过的分类色板并按既定 slot 顺序取色 —— 顺序本身就是 色盲安全机制,不是审美选择,因此只取不循环 - 浅色 worst adjacent CVD ΔE 9.1 / 常视觉 22.9 深色 worst adjacent CVD ΔE 8.4 / 常视觉 19.8,两档全部通过 - 浅色表面下 aqua 2.74:1、yellow 2.11:1 低于 3:1,按规范提供 "relief":每张图都带表格视图,且图例始终与文字标签同现 - 深色不是自动反色,是同色相针对深色表面重新取阶并单独校验 - 状态色(good/warning/serious/critical)保留专用,绝不当作 第 N 个系列色;且始终图标 + 文字同现,不靠颜色单独表意 图表规范: - 单一 y 轴,绝不双轴;量纲不同的指标拆成不同图 - 2px 线宽、4px 圆角柱端锚定基线、堆叠段间 2px 表面色间隙、 悬停标记 2px 表面色描边 - 两系列以上必有图例,单系列不加(标题已经点明) - 折线 connectNulls,设备漏记的日子不把线打断 - 数值文字一律用文字色令牌,不染系列色 其他: - 主题切换(自动/浅色/深色),选择写入 localStorage 并标在 <html> - 导航改为顶部横向,移动端可横滑 - 表格、徽章、空状态等组件统一到设计令牌 验证方式: DOM 审计确认 2px 线宽、圆角为 A 4,4 弧、堆叠段 2px 间隙、图例数量与系列数匹配、两档主题令牌各自解析到校验过的色值。 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
102
client/src/theme.css
Normal file
102
client/src/theme.css
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Design tokens.
|
||||
*
|
||||
* The series colours are the validated categorical palette, in its documented
|
||||
* slot order — the ordering is the colour-blind-safety mechanism, not a
|
||||
* cosmetic choice, so slots are assigned in order and never cycled.
|
||||
* Verified with the palette validator in both modes:
|
||||
* light worst adjacent CVD ΔE 9.1, normal-vision ΔE 22.9
|
||||
* dark worst adjacent CVD ΔE 8.4, normal-vision ΔE 19.8
|
||||
* On the light surface aqua (2.74:1) and yellow (2.11:1) fall below 3:1, so
|
||||
* every chart using them ships visible labels plus a table view.
|
||||
*/
|
||||
|
||||
:root {
|
||||
color-scheme: light;
|
||||
|
||||
/* surfaces & ink */
|
||||
--surface-0: #f4f4f2;
|
||||
--surface-1: #fcfcfb;
|
||||
--surface-2: #ffffff;
|
||||
--border: #e4e3df;
|
||||
--border-strong: #d3d2cd;
|
||||
--text-primary: #0b0b0b;
|
||||
--text-secondary: #52514e;
|
||||
--text-muted: #86847e;
|
||||
|
||||
/* categorical series — assign in order */
|
||||
--series-1: #2a78d6; /* blue */
|
||||
--series-2: #eb6834; /* orange */
|
||||
--series-3: #1baf7a; /* aqua */
|
||||
--series-4: #eda100; /* yellow */
|
||||
--series-5: #e87ba4; /* magenta */
|
||||
--series-6: #008300; /* green */
|
||||
|
||||
/* status — reserved, never reused as a series */
|
||||
--status-good: #0ca30c;
|
||||
--status-warning: #fab219;
|
||||
--status-serious: #ec835a;
|
||||
--status-critical: #d03b3b;
|
||||
|
||||
--grid: #eceae5;
|
||||
--accent: #2a78d6;
|
||||
--accent-soft: #eef4fd;
|
||||
|
||||
--radius: 10px;
|
||||
--shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 8px rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
/* Dark steps are the same hues re-stepped for the dark surface — selected and
|
||||
validated as a set, not an automatic inversion. Declared under both the OS
|
||||
media query and the explicit toggle so either can win. */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:where(:not([data-theme='light'])) {
|
||||
color-scheme: dark;
|
||||
--surface-0: #131312;
|
||||
--surface-1: #1a1a19;
|
||||
--surface-2: #232322;
|
||||
--border: #34342f;
|
||||
--border-strong: #45443e;
|
||||
--text-primary: #ffffff;
|
||||
--text-secondary: #c3c2b7;
|
||||
--text-muted: #8f8e85;
|
||||
|
||||
--series-1: #3987e5;
|
||||
--series-2: #d95926;
|
||||
--series-3: #199e70;
|
||||
--series-4: #c98500;
|
||||
--series-5: #d55181;
|
||||
--series-6: #008300;
|
||||
|
||||
--grid: #2c2c28;
|
||||
--accent: #3987e5;
|
||||
--accent-soft: #1d2938;
|
||||
|
||||
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
}
|
||||
|
||||
:root[data-theme='dark'] {
|
||||
color-scheme: dark;
|
||||
--surface-0: #131312;
|
||||
--surface-1: #1a1a19;
|
||||
--surface-2: #232322;
|
||||
--border: #34342f;
|
||||
--border-strong: #45443e;
|
||||
--text-primary: #ffffff;
|
||||
--text-secondary: #c3c2b7;
|
||||
--text-muted: #8f8e85;
|
||||
|
||||
--series-1: #3987e5;
|
||||
--series-2: #d95926;
|
||||
--series-3: #199e70;
|
||||
--series-4: #c98500;
|
||||
--series-5: #d55181;
|
||||
--series-6: #008300;
|
||||
|
||||
--grid: #2c2c28;
|
||||
--accent: #3987e5;
|
||||
--accent-soft: #1d2938;
|
||||
|
||||
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
Reference in New Issue
Block a user