# 基础 Token

> 基础 token 保存原始设计值，语义角色定义用途，组件配置组合布局与交互状态。

网页来源：/design/tokens

版本：@quirekit/ui 0.3.1；源码修订：d79a6b48d00e+worktree。此文档对应当前源码构建，接入方式以开始使用为准。

### 当前默认值与语义映射

下表与网页 Token 图谱使用同一份源码生成数据；未标注主题的值适用于全部内置主题。base 是基础值，theme 是语义角色，css 是实际 CSS 变量。自定义主题应通过 createTheme 计算。

| 名称 | 值 / 主题 | 依赖 |
| --- | --- | --- |
| base.color.source.cobalt | #425be1 |  |
| base.color.source.violet | #814fb3 |  |
| base.color.source.blue | #0e6ee6 |  |
| base.color.source.green | #008847 |  |
| base.color.source.amber | #f3a21a |  |
| base.color.source.red | #de2852 |  |
| base.color.source.ink | #20242a |  |
| base.color.white | #ffffff |  |
| base.color.neutralLight.0 | #fbfcfe |  |
| base.color.neutralLight.1 | #f4f6fa |  |
| base.color.neutralLight.2 | #f0f3f9 |  |
| base.color.neutralLight.3 | #eaeef5 |  |
| base.color.neutralLight.4 | #dde2ea |  |
| base.color.neutralLight.5 | #bdc3cc |  |
| base.color.neutralLight.6 | #9198a5 |  |
| base.color.neutralLight.7 | #656e7d |  |
| base.color.neutralLight.8 | #485161 |  |
| base.color.neutralLight.9 | #2b3545 |  |
| base.color.neutralLight.10 | #121c2c |  |
| base.color.neutralDark.0 | #0d1117 |  |
| base.color.neutralDark.1 | #121824 |  |
| base.color.neutralDark.2 | #1a2230 |  |
| base.color.neutralDark.3 | #202a39 |  |
| base.color.neutralDark.4 | #283344 |  |
| base.color.neutralDark.5 | #435167 |  |
| base.color.neutralDark.6 | #5c6b82 |  |
| base.color.neutralDark.7 | #8593a5 |  |
| base.color.neutralDark.8 | #99a7b9 |  |
| base.color.neutralDark.9 | #b5c0ce |  |
| base.color.neutralDark.10 | #e8edf4 |  |
| base.color.inkNeutralLight.0 | #fcfcfc |  |
| base.color.inkNeutralLight.1 | #f8f8f9 |  |
| base.color.inkNeutralLight.2 | #f2f2f4 |  |
| base.color.inkNeutralLight.3 | #eaeaee |  |
| base.color.inkNeutralLight.4 | #dbdbe0 |  |
| base.color.inkNeutralLight.5 | #b9b9c1 |  |
| base.color.inkNeutralLight.6 | #84848d |  |
| base.color.inkNeutralLight.7 | #67676f |  |
| base.color.inkNeutralLight.8 | #53535b |  |
| base.color.inkNeutralLight.9 | #404047 |  |
| base.color.inkNeutralLight.10 | #18181b |  |
| base.color.inkNeutralDark.0 | #09090b |  |
| base.color.inkNeutralDark.1 | #111113 |  |
| base.color.inkNeutralDark.2 | #19191c |  |
| base.color.inkNeutralDark.3 | #222225 |  |
| base.color.inkNeutralDark.4 | #2a2a2e |  |
| base.color.inkNeutralDark.5 | #414149 |  |
| base.color.inkNeutralDark.6 | #5a5a65 |  |
| base.color.inkNeutralDark.7 | #8a8a93 |  |
| base.color.inkNeutralDark.8 | #9e9ea7 |  |
| base.color.inkNeutralDark.9 | #b5b5bd |  |
| base.color.inkNeutralDark.10 | #f0f0f2 |  |
| base.color.neutralPalettes.slate.light.0 | #fcfdff |  |
| base.color.neutralPalettes.slate.light.1 | #f5f7fa |  |
| base.color.neutralPalettes.slate.light.2 | #f2f4f6 |  |
| base.color.neutralPalettes.slate.light.3 | #eceef2 |  |
| base.color.neutralPalettes.slate.light.4 | #dfe2e6 |  |
| base.color.neutralPalettes.slate.light.5 | #bec3ca |  |
| base.color.neutralPalettes.slate.light.6 | #94989f |  |
| base.color.neutralPalettes.slate.light.7 | #6a6e75 |  |
| base.color.neutralPalettes.slate.light.8 | #4e5158 |  |
| base.color.neutralPalettes.slate.light.9 | #32353c |  |
| base.color.neutralPalettes.slate.light.10 | #191c22 |  |
| base.color.neutralPalettes.slate.dark.0 | #0b111b |  |
| base.color.neutralPalettes.slate.dark.1 | #101925 |  |
| base.color.neutralPalettes.slate.dark.2 | #182331 |  |
| base.color.neutralPalettes.slate.dark.3 | #213041 |  |
| base.color.neutralPalettes.slate.dark.4 | #2a3b4f |  |
| base.color.neutralPalettes.slate.dark.5 | #496078 |  |
| base.color.neutralPalettes.slate.dark.6 | #667c94 |  |
| base.color.neutralPalettes.slate.dark.7 | #869aaf |  |
| base.color.neutralPalettes.slate.dark.8 | #9aaec4 |  |
| base.color.neutralPalettes.slate.dark.9 | #bfccdb |  |
| base.color.neutralPalettes.slate.dark.10 | #eef3f9 |  |
| base.color.neutralPalettes.stone.light.0 | #fdfcfa |  |
| base.color.neutralPalettes.stone.light.1 | #faf8f5 |  |
| base.color.neutralPalettes.stone.light.2 | #f5f1eb |  |
| base.color.neutralPalettes.stone.light.3 | #ede7e0 |  |
| base.color.neutralPalettes.stone.light.4 | #dfd5cb |  |
| base.color.neutralPalettes.stone.light.5 | #c4b8ac |  |
| base.color.neutralPalettes.stone.light.6 | #8e847a |  |
| base.color.neutralPalettes.stone.light.7 | #6f655d |  |
| base.color.neutralPalettes.stone.light.8 | #5b524b |  |
| base.color.neutralPalettes.stone.light.9 | #463f39 |  |
| base.color.neutralPalettes.stone.light.10 | #211e1b |  |
| base.color.neutralPalettes.stone.dark.0 | #100e0c |  |
| base.color.neutralPalettes.stone.dark.1 | #181512 |  |
| base.color.neutralPalettes.stone.dark.2 | #221e1a |  |
| base.color.neutralPalettes.stone.dark.3 | #2c2722 |  |
| base.color.neutralPalettes.stone.dark.4 | #38312a |  |
| base.color.neutralPalettes.stone.dark.5 | #5c5248 |  |
| base.color.neutralPalettes.stone.dark.6 | #796d60 |  |
| base.color.neutralPalettes.stone.dark.7 | #9a8e7f |  |
| base.color.neutralPalettes.stone.dark.8 | #aea293 |  |
| base.color.neutralPalettes.stone.dark.9 | #c9c0b5 |  |
| base.color.neutralPalettes.stone.dark.10 | #f3eee7 |  |
| base.color.curveLight.lightnessShift.0 | 0.94 |  |
| base.color.curveLight.lightnessShift.1 | 0.85 |  |
| base.color.curveLight.lightnessShift.2 | 0.72 |  |
| base.color.curveLight.lightnessShift.3 | 0.52 |  |
| base.color.curveLight.lightnessShift.4 | 0.28 |  |
| base.color.curveLight.lightnessShift.5 | 0 |  |
| base.color.curveLight.lightnessShift.6 | 0.06 |  |
| base.color.curveLight.lightnessShift.7 | 0.16 |  |
| base.color.curveLight.lightnessShift.8 | 0.29 |  |
| base.color.curveLight.lightnessShift.9 | 0.36 |  |
| base.color.curveLight.lightnessShift.10 | 0.43 |  |
| base.color.curveLight.chroma.0 | 0.14 |  |
| base.color.curveLight.chroma.1 | 0.28 |  |
| base.color.curveLight.chroma.2 | 0.46 |  |
| base.color.curveLight.chroma.3 | 0.65 |  |
| base.color.curveLight.chroma.4 | 0.84 |  |
| base.color.curveLight.chroma.5 | 1 |  |
| base.color.curveLight.chroma.6 | 1 |  |
| base.color.curveLight.chroma.7 | 0.92 |  |
| base.color.curveLight.chroma.8 | 0.76 |  |
| base.color.curveLight.chroma.9 | 0.8 |  |
| base.color.curveLight.chroma.10 | 0.78 |  |
| base.color.curveDark.lightnessShift.0 | 0.55 |  |
| base.color.curveDark.lightnessShift.1 | 0.47 |  |
| base.color.curveDark.lightnessShift.2 | 0.41 |  |
| base.color.curveDark.lightnessShift.3 | 0.28 |  |
| base.color.curveDark.lightnessShift.4 | 0.14 |  |
| base.color.curveDark.lightnessShift.5 | 0 |  |
| base.color.curveDark.lightnessShift.6 | 0.06 |  |
| base.color.curveDark.lightnessShift.7 | 0.18 |  |
| base.color.curveDark.lightnessShift.8 | 0.34 |  |
| base.color.curveDark.lightnessShift.9 | 0.52 |  |
| base.color.curveDark.lightnessShift.10 | 0.72 |  |
| base.color.curveDark.chroma.0 | 0.16 |  |
| base.color.curveDark.chroma.1 | 0.28 |  |
| base.color.curveDark.chroma.2 | 0.43 |  |
| base.color.curveDark.chroma.3 | 0.62 |  |
| base.color.curveDark.chroma.4 | 0.81 |  |
| base.color.curveDark.chroma.5 | 1 |  |
| base.color.curveDark.chroma.6 | 1 |  |
| base.color.curveDark.chroma.7 | 0.9 |  |
| base.color.curveDark.chroma.8 | 0.85 |  |
| base.color.curveDark.chroma.9 | 0.48 |  |
| base.color.curveDark.chroma.10 | 0.26 |  |
| base.color.palettes.#f3a21a.light.0 | #fff6eb |  |
| base.color.palettes.#f3a21a.light.1 | #ffefd9 |  |
| base.color.palettes.#f3a21a.light.2 | #ffe6c7 |  |
| base.color.palettes.#f3a21a.light.3 | #ffd39c |  |
| base.color.palettes.#f3a21a.light.4 | #ffbb5f |  |
| base.color.palettes.#f3a21a.light.5 | #f3a21a |  |
| base.color.palettes.#f3a21a.light.6 | #e99312 |  |
| base.color.palettes.#f3a21a.light.7 | #d97c09 |  |
| base.color.palettes.#f3a21a.light.8 | #ba4e00 |  |
| base.color.palettes.#f3a21a.light.9 | #aa4200 |  |
| base.color.palettes.#f3a21a.light.10 | #963a00 |  |
| base.color.sourceStep | 6 |  |
| base.color.minimumSolidContrast | 3 |  |
| base.typography.family.product | -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif |  |
| base.typography.family.mono | "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, "PingFang SC", "Microsoft YaHei", monospace |  |
| base.typography.size.12 | 12px |  |
| base.typography.size.13 | 13px |  |
| base.typography.size.14 | 14px |  |
| base.typography.size.16 | 16px |  |
| base.typography.size.20 | 20px |  |
| base.typography.size.28 | 28px |  |
| base.typography.size.40 | 40px |  |
| base.typography.lineHeight.12 | 1.6667 |  |
| base.typography.lineHeight.13 | 1.6154 |  |
| base.typography.lineHeight.14 | 1.5714 |  |
| base.typography.lineHeight.16 | 1.5 |  |
| base.typography.lineHeight.20 | 1.4 |  |
| base.typography.lineHeight.28 | 1.2857 |  |
| base.typography.lineHeight.40 | 1.2 |  |
| base.typography.weight.regular | 400 |  |
| base.typography.weight.medium | 500 |  |
| base.typography.weight.semibold | 600 |  |
| base.typography.letterSpacing.normal | normal |  |
| base.typography.letterSpacing.tight | -0.01em |  |
| base.spacing.0 | 0px |  |
| base.spacing.2 | 2px |  |
| base.spacing.4 | 4px |  |
| base.spacing.6 | 6px |  |
| base.spacing.8 | 8px |  |
| base.spacing.12 | 12px |  |
| base.spacing.16 | 16px |  |
| base.spacing.20 | 20px |  |
| base.spacing.24 | 24px |  |
| base.spacing.32 | 32px |  |
| base.spacing.40 | 40px |  |
| base.spacing.48 | 48px |  |
| base.spacing.64 | 64px |  |
| base.radius.0 | 0px |  |
| base.radius.2 | 2px |  |
| base.radius.4 | 4px |  |
| base.radius.6 | 6px |  |
| base.radius.8 | 8px |  |
| base.radius.12 | 12px |  |
| base.radius.999 | 999px |  |
| base.borderWidth.0 | 0px |  |
| base.borderWidth.1 | 1px |  |
| base.borderWidth.2 | 2px |  |
| base.elevation.light.0 | none |  |
| base.elevation.light.1 | 0 1px 2px rgb(15 23 42 / 0.08), 0 1px 1px rgb(15 23 42 / 0.04) |  |
| base.elevation.light.2 | 0 12px 32px rgb(15 23 42 / 0.12), 0 2px 8px rgb(15 23 42 / 0.08) |  |
| base.elevation.light.3 | 0 24px 64px rgb(15 23 42 / 0.18), 0 8px 24px rgb(15 23 42 / 0.10) |  |
| base.elevation.dark.0 | none |  |
| base.elevation.dark.1 | 0 2px 4px rgb(0 0 0 / 0.32), 0 0 0 1px rgb(255 255 255 / 0.06) |  |
| base.elevation.dark.2 | 0 16px 40px rgb(0 0 0 / 0.48), 0 0 0 1px rgb(255 255 255 / 0.08) |  |
| base.elevation.dark.3 | 0 28px 72px rgb(0 0 0 / 0.60), 0 0 0 1px rgb(255 255 255 / 0.10) |  |
| base.motion.duration.0 | 0ms |  |
| base.motion.duration.120 | 120ms |  |
| base.motion.duration.180 | 180ms |  |
| base.motion.duration.240 | 240ms |  |
| base.motion.easing.standard | cubic-bezier(0.2, 0, 0, 1) |  |
| base.motion.easing.accelerate | cubic-bezier(0.4, 0, 1, 1) |  |
| base.motion.easing.decelerate | cubic-bezier(0, 0, 0.2, 1) |  |
| base.opacity.0 | 0 |  |
| base.opacity.30 | 0.3 |  |
| base.opacity.42 | 0.42 |  |
| base.opacity.68 | 0.68 |  |
| base.opacity.78 | 0.78 |  |
| base.opacity.88 | 0.88 |  |
| base.opacity.94 | 0.94 |  |
| base.opacity.100 | 1 |  |
| base.layer.0 | 0 |  |
| base.layer.100 | 100 |  |
| base.layer.1000 | 1000 |  |
| base.layer.1100 | 1100 |  |
| base.layer.1200 | 1200 |  |
| base.layer.1300 | 1300 |  |
| base.size.16 | 16px |  |
| base.size.20 | 20px |  |
| base.size.24 | 24px |  |
| base.size.28 | 28px |  |
| base.size.32 | 32px |  |
| base.size.36 | 36px |  |
| base.size.40 | 40px |  |
| base.size.44 | 44px |  |

完整名称、当前值与逐层依赖见 [Token 图谱](/raw/design/token-atlas.md)。图谱从源码生成，并随 token 变更进行同步检查。

## 为什么以语义角色连接组件

基础值描述颜色和几何，语义角色描述用途，组件配置把用途落实到部件与状态。通过这三层，主题可以调整具体值，而 Button、Alert 与页面仍围绕相同的任务含义组合。

例如，实心背景与文字各自引用对应角色；背景颜色改变后，主题可以重新计算可读前景。组件无需为 warning 或某个 HEX 单独维护一套临时文字色。算法范围和未达标配对仍需要透明记录，见[色彩体系](/raw/design/color.md)。

## 如何选择与扩展 token

文字的颜色层级与 HTML 语义、排版样式分别选择。四档基础文字色全部直接引用 neutral：

| 角色 | 中性色阶 | 用途 |
| --- | --- | --- |
| `text.primary` | 11 | 标题、正文、输入值与主要标签，最强的常规文字 |
| `text.secondary` | 10 | 补充内容与次要说明 |
| `text.tertiary` | 9 | 时间、计数与元信息，可用于中性交互背景 |
| `text.muted` | 8 | 静态中性背景上的弱提示 |

单个组件通常只需要两三档。标题通过标题标签与排版角色建立层级，行内重要内容使用 `strong`、语气强调使用 `em`；共同继承当前文字色。原生 HTML 样式与 `QuireTypography` 的用法见[文字](/raw/design/typography.md)。

`text.placeholder` 独立表示尚未填写的值，映射 neutral 7，比 `muted` 浅一阶：Input、Textarea、InputNumber、Combobox、TagsInput 与 Editable 的原生占位文字，以及 Select 空值、DateInput 未填写分段，都使用这个角色。它与 `text.disabled` 共用基础值并保留独立 CSS 变量，作为安静的提示，不按正文 4.6:1 校验，只要求在字段表面与悬停背景上仍可辨认。

`text.disabled` 映射 neutral 7，只用于不可用状态，不叠加整层 opacity 使文字二次变淡，也不代替可操作输入框的占位提示。`text.accent`、`text.inverse` 与 `text.onAccent` 分别承担品牌强调、反色和实心主操作的配对；success、warning 等状态文字使用对应色族的 `.text`，从同族色阶取可读的颜色。

四种中性色与明暗模式共享上述映射，保留各自色相。亮色 Precision 的四档文字为 `#121c2c / #2b3545 / #485161 / #656e7d`。修改基础 neutral 色板会同步影响文字、表面与边界；不另建文字色板，也不插值生成色阶之外的灰色。`tertiary` 需覆盖 hover、selected、pressed，`muted` 按各自消费背景校验，`placeholder` 作为提示文字单独约束。默认八组主题以 4.6:1 为可读文字配对的检查目标，为普通文字 4.5:1 的要求留出余量。

实心中性背景与 Tooltip 使用 `surface.inverse`，也映射 neutral 11，与 `text.inverse` 配对。相同基础色可以有多个用途不同的语义映射；组件仍引用自身职责对应的变量。宿主替换 neutral 时，需要同时复查文字、背景与边界的实际组合。

先查找用途匹配的语义角色。若确有新的关系需要表达，应说明它出现在哪些场景、与现有角色有何区别、如何适配明暗模式，再决定增加公共角色还是留在具体组件配置中。

调整公共 token 时，在多个消费组件中比较结果，尤其检查文字、边界、交互状态和窄布局。一个示例变好不代表所有使用场景同时改善；验收范围应随角色的使用范围扩大。记录方法见[设计验收](/raw/design/review.md)。
