@classic-homes/theme-tokens

中文文档
0.7.1发布于 2026/11/05MITTypeScriptESM + CJS零依赖近 30 天下载 3012

Design tokens for the Classic theme system

原始使用文档
文档目录3 节
  1. Installation
  2. Quick Start
  3. Exports

@classic-homes/theme-tokens

Design tokens for the Classic Theme system, exported as TypeScript constants, CSS custom properties, and WCAG contrast helpers.

Installation

npm install @classic-homes/theme-tokens

Quick Start

import { colors, spacing, tokens } from '@classic-homes/theme-tokens';

const primary = colors.teal[500];

Load the CSS variables once in your app:

@import '@classic-homes/theme-tokens/css';

Exports

ImportContents
@classic-homes/theme-tokensToken objects: colors, brandColors, statusColors, semanticColors, layoutColors, fontFamily, fontSize, fontWeight, spacing, borderRadius, boxShadow, zIndex, aspectRatio, breakpoints, transition, focusRing, animation, and the combined tokens (also the default export)
@classic-homes/theme-tokens/contrastgetContrastRatio, getLuminance, meetsWCAGContrast, validateContrast, getContrastTextColor, suggestContrastAdjustment
@classic-homes/theme-tokens/cssdist/tokens.css: CSS custom properties for the tokens

Contrast check:

import { getContrastRatio } from '@classic-homes/theme-tokens/contrast';

const ratio = getContrastRatio('#3ba4a7', '#ffffff');

版本与发布记录

@classic-homes/theme-tokens 共发布 63 个版本,首次发布于 2026/01/09;过去 12 个月发布了 63 个版本。

版本发布日期距今
0.7.1latest2026/11/055 天前
0.7.02026/11/046 天前
0.6.02026/10/1624 天前
0.5.22026/10/081 个月前
0.4.02026/09/261 个月前
0.2.02026/08/152 个月前

关于 @classic-homes/theme-tokens 的常见问题

@classic-homes/theme-tokens 是什么?

Design tokens for the Classic theme system

如何安装 @classic-homes/theme-tokens?

在项目目录运行 npm install @classic-homes/theme-tokens,或使用 pnpm add / yarn add / bun add。

@classic-homes/theme-tokens 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@classic-homes/theme-tokens 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@classic-homes/theme-tokens 可以商用吗?

@classic-homes/theme-tokens 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@classic-homes/theme-tokens 的下载量有多少?

根据 npm 官方下载统计,@classic-homes/theme-tokens 在 2026/10/10 – 2026/11/08 这 30 天内被下载 3,012 次,日均约 100 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@classic-homes/theme-tokens 还在维护吗?

最新版本 0.7.1 发布于 2026/11/05(5 天前);至今共发布 63 个版本,其中过去 12 个月发布了 63 个;首次发布于 2026/01/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。