ss-tokens
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDesign Token Manager
Design Token 管理器
When NOT to use
不适用于以下场景
- For applying tokens in components → use or
/ss-component/ss-pattern - For finding token violations in existing code → use
/ss-lint - For non-CSS token systems (Figma, native iOS/Android) — Tailwind v4 / CSS variables only
Action: $0 | Token type: $1
Arguments: $ARGUMENTS
- 如需在组件中应用令牌 → 使用 或
/ss-component/ss-pattern - 如需查找现有代码中的令牌违规问题 → 使用
/ss-lint - 非CSS令牌系统(Figma、原生iOS/Android)——仅支持Tailwind v4 / CSS variables
Action: $0 | Token type: $1
Arguments: $ARGUMENTS
Token File Locations
令牌文件位置
| Type | JSON Source | CSS Implementation |
|---|---|---|
| Colors | | |
| Typography | | |
| Spacing | | Tailwind utilities (no custom CSS needed) |
| Radius | | |
| Shadows | | |
| 类型 | JSON源文件 | CSS实现文件 |
|---|---|---|
| 颜色 | | |
| 排版 | | |
| 间距 | | Tailwind工具类(无需自定义CSS) |
| 圆角 | | |
| 阴影 | | |
Instructions
使用说明
generate color
— Derive the system from one key color
generate colorgenerate color
— 从单一主色调生成配色系统
generate colorDo not pick a second color by eye or copy a preset. Run the shared StyleSeed generator:
bash
node <styleseed-root>/engine/color/generate-palette.mjs \
--key-color "#276B5E" \
--mode light \
--character calm \
--harmony auto \
--temperature neutral \
--out .styleseed/palette.jsonSupported controls are mode, character,
harmony, and surface temperature.
The generator preserves the key hue, maps chroma into sRGB without channel clipping, builds
11-step OKLCH primary/accent ramps, scores the accent against the key and reserved status hues,
maps primitives to semantic roles, and adjusts fill lightness until text/action/focus pairs pass.
light|darkcalm|balanced|vivid|deepauto|tonal|adjacent|contrastneutral|warm|coolUse for CSS variables or JSON for an auditable result. Never mark the palette
valid unless is true and every item in passes. In , persist
, , , , and ,
then run ; the resolver emits the same and .
--format cssvalidcontrastSTYLESEED.mdKey colorPalette characterPalette modePalette harmonySurface temperature$ss-resolve.styleseed/palette.jsonpalette.css请勿手动挑选第二种颜色或复制预设方案。运行共享的StyleSeed生成器:
bash
node <styleseed-root>/engine/color/generate-palette.mjs \
--key-color "#276B5E" \
--mode light \
--character calm \
--harmony auto \
--temperature neutral \
--out .styleseed/palette.json支持的控制参数包括模式、风格、配色和谐度,以及表面色调。该生成器会保留主色调的色相,将色度映射到sRGB色域且避免通道裁剪,构建包含11个层级的OKLCH主色/强调色渐变,对比强调色与主色调及预留状态色调的匹配度,将基础色映射到语义角色,并调整填充色亮度,直到文本/操作/焦点组合通过无障碍对比度检测。
light|darkcalm|balanced|vivid|deepauto|tonal|adjacent|contrastneutral|warm|cool使用参数可生成CSS变量,使用JSON格式可生成可审计的结果。只有当为true且所有对比度检测项均通过时,才能标记调色板为有效。在中记录、、、和,然后运行;解析器会生成相同的和文件。
--format cssvalidSTYLESEED.mdKey colorPalette characterPalette modePalette harmonySurface temperature$ss-resolve.styleseed/palette.jsonpalette.csslist
— Show current tokens
listlist
— 查看当前令牌
listRead and display the requested token file in a formatted table.
读取并以格式化表格的形式显示指定的令牌文件。
add
— Add new token
addadd
— 添加新令牌
add- Add the token to the JSON source file ()
tokens/*.json - Add the CSS custom property to under
css/theme.css:root - If it needs a Tailwind utility, add to the block
@theme inline - If it has a dark mode variant, add to the block
.dark
- 将令牌添加到JSON源文件()
tokens/*.json - 在的
css/theme.css下添加对应的CSS自定义属性:root - 如需生成Tailwind工具类,添加到块中
@theme inline - 如需支持暗色模式变体,添加到块中
.dark
update
— Modify existing token
updateupdate
— 修改现有令牌
update- Update the value in the JSON source file
- Update the CSS custom property in
theme.css - Check all components for direct usage that might need updating
- 更新JSON源文件中的值
- 更新中的CSS自定义属性
theme.css - 检查所有直接使用该令牌的组件,确认是否需要同步更新
Rules
规则
- Always keep JSON and CSS in sync
- Use semantic names, not descriptive names (not
--success)--green-500 - Colors should support both light and dark modes
- New tokens must be added to BOTH the JSON source AND the CSS implementation
- Treat preset recipes as maintained defaults, not the limit of available colors.
- Character and role allocation are stronger design controls than complementary/triadic geometry alone.
- 始终保持JSON源文件与CSS实现文件同步
- 使用语义化命名,而非描述性命名(如而非
--success)--green-500 - 颜色需同时支持亮色和暗色模式
- 新增令牌必须同时添加到JSON源文件和CSS实现文件中
- 将预设方案视为维护的默认值,而非可用颜色的上限
- 风格与角色分配是比互补色/三色几何搭配更强的设计控制手段。