fix(docs): restore pinned color demos and color values

This commit is contained in:
maoyingjie
2026-10-27 23:24:15 +08:00
parent 748abe4dfe
commit dd0d7b22ee
10 changed files with 1228 additions and 98 deletions
+15 -15
View File
@@ -5,55 +5,55 @@ description: HeroUI v3 的调色板与主题系统
颜色通过语义变量表达用途。浅色和深色共用变量名称,由主题容器决定实际取值;组件使用变量而不是各自硬编码品牌色。本页沿用固定 HeroUI 基线的颜色分类,类名使用本库的 `hv-` 前缀。
以下色板同时展示 Light / Dark。悬停或键盘聚焦查看变量名,点击色块复制浏览器解析后的颜色值;复制的是当前主题下的颜色,不是变量名。
以下色板同时展示 Light / Dark。悬停或键盘聚焦查看变量名,点击色块复制浏览器解析后的颜色值;复制的是当前主题下的颜色,不是变量名。实色与柔和色、明暗色阶、字段预览和基础色分别沿用官方演示结构;显式混色公式也与固定源演示一致。
## 强调色
强调色代表品牌或产品的主识别色,用于吸引对关键操作、高亮与重点时刻的注意。应节制使用,以保留视觉层级。组件从基础强调色派生悬停和柔和背景;改变 `--accent` 时也应保证配对前景色可读。
<DocsColorSection name="强调色" :tokens="['--accent', '--accent-hover', '--accent-foreground', '--accent-soft', '--accent-soft-hover', '--accent-soft-foreground']" />
<DocsColorSection section="accent" />
## 默认(中性色)
默认色构成系统的中性骨架,适用于大多数非强调的界面元素。它与页面背景、卡片表面有不同用途,不应随意互换。
<DocsColorSection name="默认" :tokens="['--default', '--default-hover', '--default-foreground', '--default-soft', '--default-soft-hover', '--default-soft-foreground']" />
<DocsColorSection section="default" />
## 成功
成功色表达积极结果、确认与完成状态,常见于反馈、状态指示与校验通过等场景。
<DocsColorSection name="成功" :tokens="['--success', '--success-hover', '--success-foreground', '--success-soft', '--success-soft-hover', '--success-soft-foreground']" />
<DocsColorSection section="success" />
## 警告
警告色表示需要谨慎、存在风险或需要留意的操作。它用于提醒和复核,不应替代危险色表达破坏性操作。
<DocsColorSection name="警告" :tokens="['--warning', '--warning-hover', '--warning-foreground', '--warning-soft', '--warning-soft-hover', '--warning-soft-foreground']" />
<DocsColorSection section="warning" />
## 危险
危险色用于错误、严重告警和破坏性操作。组件的错误样式还需要关联错误说明与实际校验语义,仅改变颜色不会使字段成为无效状态。
<DocsColorSection name="危险" :tokens="['--danger', '--danger-hover', '--danger-foreground', '--danger-soft', '--danger-soft-hover', '--danger-soft-foreground']" />
<DocsColorSection section="danger" />
## 前景色
`--foreground` 用于正文与图标,`--muted` 用于次要信息。带专用背景的组件应使用其配对前景色,例如 `--accent-foreground`,而不是固定白色。
<DocsColorSection name="前景色" :tokens="['--foreground', '--muted']" />
<DocsColorSection section="foreground" />
## 背景色
背景是界面的基底画布;secondary 和 tertiary 在同一画布上建立层级。inverse 提供反色背景,使用时仍需自行确认文字对比度。
<DocsColorSection name="背景色" :tokens="['--background', '--background-secondary', '--background-tertiary', '--background-inverse']" />
<DocsColorSection section="background" />
## 表面色
表面色用于卡片、面板和其他非浮层容器;`--overlay` 专门用于 Popover、Modal、菜单等浮层。表面通过明度、层级和阴影区分内容,不依赖强烈色相差异。
<DocsColorSection name="表面色" :tokens="['--surface', '--surface-secondary', '--surface-tertiary', '--surface-hover', '--overlay']" />
<DocsColorSection section="surface" />
每层还有对应的 foreground:`--surface-foreground`、`--surface-secondary-foreground`、`--surface-tertiary-foreground` 和 `--overlay-foreground`。
@@ -61,29 +61,29 @@ description: HeroUI v3 的调色板与主题系统
字段有独立的背景、文本、placeholder、hover/focus 和边框变量。修改这些变量可以调整表单而不改变按钮或卡片的基础表面。
<DocsColorSection name="表单字段" :tokens="['--field-background', '--field-foreground', '--field-placeholder', '--field-hover', '--field-focus', '--field-border', '--field-border-hover', '--field-border-focus']" />
<DocsColorSection section="field" />
默认 `--field-border` 是透明色,色板可能显示底层表面。`--field-border-width` 决定字段描边宽度;焦点环使用 `--focus`,错误状态使用 `--danger`。
字段预览展示背景、Hover、Focus、Placeholder 与 Foreground。Hover 色块沿用固定源演示的 90% 背景 + 10% 前景公式;它是配色演示,不宣称等同于组件当前的 `--field-hover`(前景配比 2%)。默认 `--field-border` 是透明色。`--field-border-width` 决定字段描边宽度;焦点环使用 `--focus`,错误状态使用 `--danger`。
## 分隔线
分隔线用于轻量组织内容,边框用于轮廓。secondary/tertiary 是相对于表面的派生层次。
<DocsColorSection name="分隔与边框" :tokens="['--separator', '--separator-secondary', '--separator-tertiary', '--border', '--border-secondary', '--border-tertiary']" />
<DocsColorSection section="separator" />
## 其他
焦点、链接、分段控件、遮罩和滚动条也使用语义变量。
<DocsColorSection name="其他" :tokens="['--focus', '--link', '--segment', '--segment-foreground', '--backdrop', '--scrollbar-thumb', '--scrollbar-track']" />
<DocsColorSection section="other" />
`--scrollbar-track` 默认透明,滚动条的宽度和模式参见[主题中的滚动条](/themes#滚动条)。
滚动条的宽度和模式参见[主题中的滚动条](/themes#滚动条)。
## 基础色
基础色是主题的底层取值,明暗模式之间不变。业务页面通常优先选择语义颜色,而不是直接使用黑色或白色。
<DocsColorSection name="基础色" :tokens="['--white', '--black', '--snow', '--eclipse']" />
<DocsColorSection section="primitive" />
## 如何使用颜色