SuperAPI AI 工具集

token-lookup

前端与建站

查看项目

更新于 10-16 06:47

技能介绍

用途:把代码中硬编码的 CSS 值替换为 Fluent UI 的 @fluentui/react-theme 设计令牌。先判断值类别:十六进制/rgb/颜色名对应颜色令牌,px/rem 间距对应 spacing 令牌,px/rem 字号对应 font size 令牌,px/rem 圆角对应 border radius 令牌,字重(400、600、bold)对应 font weight 令牌,box-shadow 对应 shadow 令牌,边框宽度对应 stroke width 令牌,时长(ms/s)对应 duration 令牌。随后在主题源码 packages/react-components/react-theme/library/src/ 中查找匹配值,重点查看 colorPalette*.ts、global/、alias/ 等主题文件。返回令牌名与用法,例如用 import { tokens } from '@fluentui/react-theme'; 后写 color: tokens.colorBrandBackground; 替代 color: '#0078d4'。若没有精确匹配,则建议最接近的语义令牌并说明差异;令牌类别可参考 docs/architecture/design-tokens.md。资料给出的常见映射包括 #0078d4→tokens.colorBrandBackground、#323130→tokens.colorNeutralForeground1、#ffffff→tokens.colorNeutralBackground1、4px 圆角→tokens.borderRadiusMedium、8px 内边距→tokens.spacingHorizontalS 或 tokens.spacingVerticalS、14px 字号→tokens.fontSizeBase300、600 字重→tokens.fontWeightSemibold,但这些为近似值,需以实际主题源码为准。限制:资料未提供安装命令、收费方式、平台支持或具体调用参数,暂未提供。