OntoX 设计系统

恒远智能科技设计语言平台 —— 确定性、意义感、生长性、自然性

设计价值观

确定性

通过统一的 Token 体系,确保设计落地的一致性,让每一次交互都符合预期。

意义感

每个设计决策都有据可依,让界面不只是好看,更有深层的设计逻辑支撑。

生长性

设计系统持续迭代,支持业务快速扩展,让产品随需求自然生长。

自然性

遵循自然交互规律,让界面操作如呼吸般自然流畅,降低用户认知负担。

核心优势

136 色彩 Token

完整的色彩体系,包含 Primary、Success、Warning、Error 四大语义色,以及 10 级灰度色阶。

76 间距 Token

4px 基准网格系统,覆盖所有布局场景,确保界面的节奏感和层次感。

深色模式

完整的深色主题支持,所有 Token 自动映射,一套代码适配两种模式。

AI Skill

设计态与运行态双 Skill 支持,让 AI 能够理解并应用 H4 设计系统。

快速接入

1. 引入 CSS Token

:root {
  --h4-primary-colorprimary: #1e89ff;
  --h4-bg-colorbglayout: #f7f8fa;
  /* ... 完整 Token 定义 */
}

2. 使用 Token

.my-button {
  background: var(--h4-primary-colorprimary);
  border-radius: var(--h4-borderradius-md);
  color: var(--h4-text-colortextlightsolid);
}

3. 深色模式

<html data-theme="dark">
  /* Token 自动映射为深色值 */
</html>

设计语言

OntoX 设计哲学:确定性、意义感、生长性、自然性

四大设计价值观

确定性:通过统一的 Token 体系,确保设计落地的一致性。每个颜色、间距、圆角都有明确的 Token 名称,开发者无需猜测。
意义感:每个设计决策都有据可依。色彩不仅好看,还承载语义(Primary=品牌主色,Success=成功状态)。
生长性:设计系统持续迭代,支持业务快速扩展。新增组件时,直接复用现有 Token,无需重新设计。
自然性:遵循自然交互规律,过渡动画 0.2s ease,符合人类感知节奏。

8 条强制规则

  • Rule 1:所有颜色必须使用 CSS Token,禁止硬编码色值
  • Rule 2:间距必须使用 Gap Token,遵循 4px 基准网格
  • Rule 3:圆角必须使用 BorderRadius Token,禁止自定义像素值
  • Rule 4:阴影必须使用预定义 Shadow Token,确保层级一致
  • Rule 5:状态色必须使用语义 Token(如 --h4-error-colorerror)
  • Rule 6:深色模式必须通过 [data-theme="dark"] 实现,禁止 JS 切换样式
  • Rule 7:字体必须使用 FontFamily Token,禁止硬编码字体族
  • Rule 8:所有交互元素必须有 Focus 状态,使用 --shadow-focus

Token 架构

设计态 Token:面向设计师,使用 Figma Variables 管理,包含 136 颜色 Token、11 排版 Token、76 间距 Token 等。
运行态 Token:面向开发者,使用 CSS Custom Properties 实现,与设计态 1:1 映射。
命名规范:--h4-{类别}-{子类别}{名称},如 --h4-primary-colorprimary、--h4-borderradius-md。

设计态 vs 运行态

维度设计态(Figma)运行态(CSS)
颜色Figma VariablesCSS Custom Properties
间距Gap Variables (4px 基准)--h4-gap-* Token
圆角Radius Variables--h4-borderradius-*
字体Text Styles--h4-fontfamily-*
深色模式Light/Dark Mode[data-theme="dark"]

色彩系统

136 个颜色 Token,覆盖所有设计场景

Primary 主色

品牌主色,用于核心操作按钮、链接、关键状态指示

Primary
#1e89ff
Primary BG Base
#ebf4ff
Primary Border
#c2deff
Primary Hover
#479dff
Primary Active
#006fc8
Primary Fill Weak
#99c9ff
Primary BG Hover
#ddebff
Primary Text Strong
#004f9c
Primary Dark
#003b7a
Primary Emphasis
#0f76d6

Success 成功色

Success
#04c495
Success BG Base
#e6fff4
Success BG Hover
#cff9e0
Success Border
#a3f7d7
Success Fill Weak
#75ebc2
Success Hover
#26d1a1
Success Emphasis
#00a87f
Success Active
#008f6b
Success Text Strong
#007257
Success Dark
#005747

Warning 警告色

Warning
#ff7d00
Warning BG
#fff6e6
Warning BG Hover
#ffe8cc
Warning Border
#ffdca3
Warning Fill Weak
#ffc87a
Warning Hover
#ff9729
Warning Emphasis
#d96200
Warning Active
#b24e00
Warning Text Strong
#8c3a00
Warning Dark
#662600

Error 错误色

Error
#f63838
Error BG
#fff2f0
Error BG Hover
#ffe2de
Error Border
#ffc8c2
Error Fill Weak
#ffbcb5
Error Hover
#ff6963
Error Emphasis
#cf252b
Error Active
#a81c21
Error Text Strong
#811316
Error Dark
#5a0a0c

Gray 灰度色阶

Gray 1
#f7f8fa80
Gray 2
#f7f8fa
Gray 3
#f2f3f7
Gray 4
#e6e8ec
Gray 5
#eceff5
Gray 6
#d0d3db
Gray 7
#bdc1cb
Gray 8
#9199ac
Gray 9
#6b7790
Gray 10
#262626

语义色 Token 表

类别Token色值用途
文字色--h4-text-colortextheading#000000标题文字
文字色--h4-text-colortext#000000d9正文文字
文字色--h4-text-colortextsecondary#000000a6次要文字
文字色--h4-text-colortexttertiary#00000073辅助文字
背景色--h4-bg-colorbglayout#f7f8fa页面背景
背景色--h4-bg-colorbgcard#ffffff卡片背景
边框色--h4-border-ccolorborder#d0d3db主要边框
边框色--h4-border-colorbordersecondary#eceff5次要边框

排版系统

11 个排版 Token,确保文字层次清晰

字体族 Token

Token字体族用途
--h4-fontfamily-primaryPingFang SC, -apple-system, BlinkMacSystemFont, sans-serif正文、UI 文字
--h4-fontfamily-dataDIN Alternate, sans-serif数据展示、数字
--h4-fontfamily-monoInter, -apple-system, BlinkMacSystemFont, sans-serif代码、等宽文字

字重 Token

Token字重示例
--h4-fontweight-regular400恒远智能科技
--h4-fontweight-medium500恒远智能科技
--h4-fontweight-bold700恒远智能科技

排版层级展示

H1 标题 32px · Bold · heading
用于页面主标题,如「色彩系统」「间距系统」
H2 标题 24px · Bold · subheading
用于区块标题,如「Primary 主色」「常用间距」
H3 标题 18px · Medium · label
用于小标题、卡片标题、参数名称
正文内容 14px · Regular · body
用于正文、描述、说明文字
辅助文字 12px · Regular · caption
用于时间戳、版权信息、脚注

间距系统

基于 4px 基准网格的 76 个间距 Token,确保界面的节奏感与层次感

常用间距 Token

xs
4px · var(--h4-gap-xs)
sm
8px · var(--h4-gap-sm)
md
12px · var(--h4-gap-md)
base
16px · var(--h4-gap-base)
lg
20px · var(--h4-gap-lg)
xl
24px · var(--h4-gap-xl)
2xl
32px · var(--h4-gap-2xl)
3xl
48px · var(--h4-gap-3xl)
4xl
64px · var(--h4-gap-4xl)

间距使用规范

场景推荐间距Token说明
组件内间距4–12pxxs / sm / md图标与文字、按钮内 padding
组件间间距16–24pxbase / xl相邻输入框、按钮组间距
区块间间距32–48px2xl / 3xl表单区块、卡片组间距
页面级间距48–64px3xl / 4xl页面顶部留白、内容区边距
侧边栏内间距24–32pxxl / 2xl侧边栏项 padding、分组间距

4px 基准网格原理

所有间距值均为 4 的倍数,确保视觉节奏的统一性。间距 Token 采用 T-shirt 尺码命名(xs/sm/md/base/lg/xl/2xl/3xl/4xl),易于理解和使用。

4
8
12
16
20
24
32
48
64

圆角系统

7 级圆角 Token,从直角到超大圆角,覆盖所有组件场景

圆角可视化

0px
None
0px
2px
XS
2px
4px
SM
4px
6px
MD
6px
8px
LG
8px
10px
XL
10px
24px
XXL
24px

组件圆角映射

组件圆角等级Token应用场景
Input 输入框MD--h4-borderradius-md6px文本输入、搜索框
Button 按钮MD--h4-borderradius-md6px主要/默认/文字按钮
Card 卡片XL--h4-borderradius-xl10px信息卡片、配置面板
Modal 弹窗LG--h4-borderradius-lg8px确认对话框、表单弹窗
Table 表格MD--h4-borderradius-md6px数据表格、列表面板
Tag 标签SM--h4-borderradius-sm4px状态标签、分类标记
Avatar 头像XXL--h4-borderradius-xxl24px用户头像、图标容器
Toast 提示MD--h4-borderradius-md6px操作反馈提示条

阴影系统

6 种阴影 Token,定义层级关系

阴影展示

Page
4px 4px 32px 8px
rgba(30,47,85,0.06)
Card
4px 4px 24px 8px
rgba(30,47,85,0.06)
Modal
0px 4px 16px -2px
rgba(30,47,85,0.15)
Modal Large
0px 8px 32px -2px
rgba(30,47,85,0.15)
Dropdown
0px 2px 8px -2px
rgba(30,47,85,0.15)
Focus Ring
0px 0px 0px 2px
#ddebff

阴影参数详解

TokenX偏移Y偏移模糊半径扩展半径颜色用途
--shadow-page4px4px32px8px#1e2f55 6%页面级容器阴影
--shadow-card4px4px24px8px#1e2f55 6%卡片、面板阴影
--shadow-modal0px4px16px-2px#1e2f55 15%标准弹窗阴影
--shadow-modal-large0px8px32px-2px#1e2f55 15%大型弹窗阴影
--shadow-dropdown0px2px8px-2px#1e2f55 15%下拉菜单阴影
--shadow-focus0px0px0px2px#ddebffFocus 状态环

渐变系统

6 种渐变样式,增强视觉层次

渐变展示

Brand
135deg · #3556fd → #7ed4ff
Table Header
0deg · #f2f3f7 → #ffffff
Page Top
180deg · rgba(235,242,255) → #fff
Tab Bar
90deg · rgba(214,231,251) → rgba(185,219,248)
New Tag
90deg · #ff5863 → #ff5863
Glass Effect
134deg · #fff → rgba(255,255,255,0.2)

渐变 Token 参考

Token方向起始色终止色用途
--h4-gradient-brand135deg#3556fd#7ed4ff品牌渐变,Hero 区域、主按钮
--h4-gradient-tableheader0deg#f2f3f7#ffffff表格表头背景
--h4-gradient-pagetop180degrgba(235,242,255,1)rgba(255,255,255,1)页面顶部装饰渐变
--h4-gradient-tabbar90degrgba(214,231,251,1)rgba(185,219,248,1)底部 TabBar 背景
--h4-gradient-newtag90deg#ff5863#ff5863新功能标记红点
--h4-gradient-glass134degrgba(255,255,255,1)rgba(255,255,255,0.2)毛玻璃面板叠加效果

组件总览

基础组件、数据展示、反馈组件

基础组件

Button 按钮

三种类型,多种状态

Input 输入框

3类型 × 9状态

Card 卡片

规格表 + Demo

数据展示

Table 表格

规格表 + Demo

Transfer 穿梭框

8变体 + 6子组件

反馈组件

Modal 弹窗

规格表 + Demo

Button 按钮

三种类型,支持多种状态

主要按钮 (Primary)

.btn-primary {
  background: var(--h4-primary-colorprimary);
  color: #fff;
  border-color: var(--h4-primary-colorprimary);
}
.btn-primary:hover {
  background: var(--h4-primary-colorprimaryhover);
  box-shadow: 0 0 20px rgba(30,137,255,0.3);
}
.btn-primary:disabled {
  background: var(--h4-bg-colorbgdisabled);
  color: var(--h4-text-colortextdisabled);
  border-color: var(--h4-border-colorborderdisabled);
  cursor: not-allowed;
}

默认按钮 (Default)

文字按钮 (Text)

CSS 实现

/* 基础按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--h4-borderradius-md);
  font-size: 14px;
  font-weight: var(--h4-fontweight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}
/* 主要按钮 */
.btn-primary {
  background: var(--h4-primary-colorprimary);
  color: var(--h4-text-colortextlightsolid);
  border-color: var(--h4-primary-colorprimary);
}
.btn-primary:hover {
  background: var(--h4-primary-colorprimaryhover);
  box-shadow: 0 0 20px rgba(30,137,255,0.3);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  background: var(--h4-bg-colorbgdisabled);
  color: var(--h4-text-colortextdisabled);
  border-color: var(--h4-border-colorborderdisabled);
  cursor: not-allowed;
}

Input 输入框

3 类型 × 9 状态,完整状态机

基础输入框

状态变体

状态流转

默认 → Hover → Focus → 输入中 → 成功/错误 → 禁用

默认
Hover
Focus
成功
错误

CSS 实现

.input-field {
  width: 280px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--h4-borderradius-md);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  color: var(--h4-text-colortext);
  font-size: 14px;
  transition: all var(--transition-fast);
}
.input-field:focus {
  outline: none;
  border-color: var(--h4-primary-colorprimary);
  box-shadow: var(--shadow-focus), 0 0 20px rgba(30,137,255,0.3);
}
.input-field.error { border-color: var(--h4-error-colorerror); }
.input-field.success { border-color: var(--h4-success-colorsuccess); }

TypeScript 枚举

enum InputState {
  Default = 'default', Hover = 'hover', Focus = 'focus',
  Active = 'active', Disabled = 'disabled', Error = 'error',
  Success = 'success', Warning = 'warning', Loading = 'loading'
}
enum InputType {
  Text = 'text', Password = 'password', Search = 'search',
  Number = 'number', Email = 'email'
}

Card 卡片

基础容器组件,支持多种变体

基础卡片

卡片标题

这是一段卡片内容描述文字,用于展示卡片的基本信息和功能说明。

.card {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--h4-borderradius-xl);
  padding: 24px;
}

带阴影卡片

带阴影卡片

使用 --glass-shadow-lg 添加毛玻璃阴影效果

规格参数

参数说明默认值
border-radius圆角--h4-borderradius-xl (10px)
padding内边距24px
background背景色rgba(255,255,255,0.15)
border边框1px solid rgba(255,255,255,0.18)
shadow阴影--shadow-card

Table 表格

数据展示组件,支持排序、筛选、分页

基础表格

组件名称圆角内间距状态数量深色适配
Button 按钮6px (MD)8px 20px4 状态✓ 已适配
Input 输入框6px (MD)0 12px9 状态✓ 已适配
Card 卡片10px (XL)24px2 状态✓ 已适配
Transfer 穿梭框6px (MD)16px8 变体△ 部分适配
Modal 弹窗8px (LG)24px3 状态✓ 已适配
.table-demo {
  width: 100%;
  border-collapse: collapse;
}
.table-demo th {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
}
.table-demo tr:hover td {
  background: rgba(255,255,255,0.15);
}

规格参数

参数说明Token
表头背景表头行背景色--h4-bg-colorbgmoduledark
边框单元格边框--h4-border-colorbordertable
悬停背景行悬停背景色--h4-primary-colorprimarybg-base
圆角表格圆角--h4-borderradius-md

Transfer 穿梭框

双列表格选择器,支持搜索、排序、分页

8 种变体

基础穿梭框
带搜索
带分页
自定义渲染
树形数据
禁用状态
单列模式
拖拽排序

6 个子组件

子组件说明
TransferContainer主容器,左右两列
TransferList单列列表
TransferItem列表项
TransferSearch搜索框
TransferButton操作按钮(左右移动)
TransferPagination分页组件

IconButton 规格

IconButton 尺寸:32x32px,圆角 6px,使用 --h4-borderradius-md

Modal 弹窗

模态对话框,支持多种尺寸和交互

基础弹窗 Demo

规格参数

参数说明Token
背景遮罩半透明黑色遮罩--h4-bg-colorbgmask
弹窗背景弹窗背景色--h4-bg-colorbgmodal
圆角弹窗圆角--h4-borderradius-lg (8px)
阴影弹窗阴影--shadow-modal-large
内边距内容区内边距24px

弹窗尺寸

尺寸宽度适用场景
Small400px确认对话框、简单表单
Medium600px普通表单、信息展示
Large800px复杂表单、数据表格
Full90vw全屏操作、复杂页面

AI Skill 总览

设计态与运行态双 Skill 支持,让 AI 理解并应用 H4 设计系统

设计态 Skill

面向设计师的 AI Skill,包含 136 颜色 Token、排版 Token、间距 Token 等,支持 Figma 设计生成。

运行态 Skill

面向开发者的 AI Skill,包含 CSS Token、状态机、深色模式实现等,支持代码生成。

两个 Skill 对比

维度设计态 Skill运行态 Skill
面向对象设计师开发者
主要内容Figma Variables、设计规格CSS Token、状态机、深色模式
使用场景生成设计稿、检查设计合规性生成代码、实现交互逻辑
Token 数量136 颜色 + 11 排版 + 76 间距与设计态 1:1 映射
输出格式Figma 设计文件HTML/CSS/TS 代码

接入方式

方法一:WorkBuddy Skill 市场安装
在 WorkBuddy 中搜索 "H4 设计系统",点击安装即可。

方法二:手动配置
将 Skill 文件放置在 ~/.workbuddy/skills/ 目录下,重启 WorkBuddy 即可加载。

方法三:MCP 服务器
通过 MCP 协议连接设计系统服务器,实时获取最新 Token 定义。

设计态 Skill

面向设计师的 AI Skill,支持 Figma 设计生成与合规检查

使用场景

  • 生成符合 H4 设计规范的 Figma 设计稿
  • 自动应用正确的颜色 Token(避免硬编码色值)
  • 检查设计稿合规性(间距、圆角、字体是否符合规范)
  • 生成设计说明文档(自动引用 Token 名称)
  • 批量修改设计稿中的 Token 引用

Token 快速参考

类别数量说明
颜色 Token136Primary/Success/Warning/Error + Gray 10级
排版 Token113 字体族 + 3 字重 + 5 字号层级
间距 Token764px 基准网格,覆盖所有布局场景
圆角 Token7None/XS/SM/MD/LG/XL/XXL
阴影 Token6Page/Card/Modal/Dropdown/Focus/Button
渐变 Token2Brand/Table Header/Page Top 等

工作流

① 需求输入
② AI 生成设计
③ 应用 Token
④ 合规检查
⑤ 输出设计稿

设计检查清单

  • 所有颜色是否使用了 Token(无硬编码色值)
  • 间距是否为 4px 的倍数(使用了 Gap Token)
  • 圆角是否使用了 BorderRadius Token
  • 字体是否使用了 FontFamily Token
  • 是否提供了深色模式设计
  • 交互状态是否完整(Hover/Focus/Active/Disabled)

运行态 Skill

面向开发者的 AI Skill,支持代码生成与运行状态管理

开发规则

  • Rule 1:所有样式必须使用 CSS Token,禁止硬编码色值/间距/圆角
  • Rule 2:组件状态必须使用规范状态机(Default → Hover → Focus → ...)
  • Rule 3:深色模式必须使用 [data-theme="dark"] 选择器
  • Rule 4:所有交互元素必须有 Focus 状态(使用 --shadow-focus)
  • Rule 5:过渡动画统一使用 var(--transition-normal)(0.2s ease)
  • Rule 6:组件必须支持事件回调(onChange/onBlur/onFocus 等)

CSS Token 参考

/* 引入 H4 Token */
:root {
  --h4-primary-colorprimary: #1e89ff;
  --h4-bg-colorbglayout: #f7f8fa;
  --h4-borderradius-md: 6px;
  /* ... 完整 Token 定义 */
}
/* 深色模式自动映射 */
[data-theme="dark"] {
  --h4-primary-colorprimary: #479dff;
  --h4-bg-colorbglayout: #131313;
}
/* 使用 Token */
.my-component {
  background: var(--h4-bg-colorbgcard);
  border-radius: var(--h4-borderradius-lg);
  color: var(--h4-text-colortext);
  transition: all var(--transition-normal);
}

状态机

所有交互组件必须实现完整状态机:

Default
Hover
Focus
Active
Disabled

深色模式实现

/* 方法一:HTML 属性切换 */
<html data-theme="dark">
  
</html>

/* 方法二:JS 切换 */
function toggleTheme() {
  const html = document.documentElement;
  const theme = html.getAttribute('data-theme');
  html.setAttribute('data-theme', theme === 'dark' ? 'light' : 'dark');
}

推荐使用 data-theme 属性切换,确保所有 Token 自动映射。

TypeScript 类型定义

type ComponentState = 'default' | 'hover' | 'focus' | 'active' | 'disabled' | 'error' | 'success';
type Theme = 'light' | 'dark';
interface ButtonProps {
  type?: 'primary' | 'default' | 'text' | 'danger';
  size?: 'large' | 'medium' | 'small';
  disabled?: boolean;
  loading?: boolean;
  onClick?: () => void;
}
interface InputProps {
  type?: 'text' | 'password' | 'search' | 'number';
  value?: string;
  placeholder?: string;
  disabled?: boolean;
  error?: boolean;
  success?: boolean;
  onChange?: (value: string) => void;
}

资源

Figma 设计资源、开发工具、平台接入方式

Figma 设计资源

  • OntoX 设计系统 Figma 库
    包含完整的 136 颜色 Token、11 排版 Token、76 间距 Token、组件库
  • Figma Variables 配置文件
    可直接导入 Figma,自动生成 Light/Dark 双主题
  • 组件设计稿
    Button、Input、Card、Table、Transfer、Modal 等完整设计稿
  • 图标库
    24x24px 标准图标,支持 Figma Icon Component

下载资源

CSS Token
h4-design-tokens.css
Figma Variables
variables.json
组件库
ontox-components.figma
设计指南
design-guide.pdf

工具生态

工具说明链接
Figma PluginToken 检查与自动修复插件下载插件
VS Code ExtensionCSS Token 自动补全与检查安装扩展
Design Token Validator设计稿 Token 合规性检查工具在线使用
WorkBuddy SkillAI 设计系统 Skill安装 Skill

平台接入方式

/* NPM 安装 */
npm install @ontox/design-tokens --save

/* CDN 引入 */
<link rel="stylesheet" href="https://cdn.ontox.com/h4-design-tokens.css">

/* 在 CSS 中使用 */
.my-button {
  background: var(--h4-primary-colorprimary);
  border-radius: var(--h4-borderradius-md);
  padding: 8px 20px;
  color: var(--h4-text-colortextlightsolid);
  transition: all var(--transition-normal);
}

/* 深色模式 */
html[data-theme="dark"] .my-button {
  /* Token 自动映射,无需额外定义 */
}

联系我们

设计系统团队
邮箱:design-system@ontox.com
企业微信:搜索"OntoX 设计系统"加入交流群
GitHub:github.com/ontox/design-system

问题反馈
如发现 Token 定义错误、组件 Bug、文档问题,请在 GitHub 提交 Issue。