@sckyzo/cosmos-theme

中文文档
0.6.0发布于 2026/11/02MITES Module构建来源已验证

Tailwind 4 theme and design tokens for the Cosmos design system — palette, typography, radii and CSS variables for its light, sand, dark and deep-blue themes.

原始使用文档
文档目录7 节
  1. Install
  2. Usage
  3. With Tailwind 4 (recommended for React apps)
  4. Without Tailwind (e.g. Docusaurus)
  5. Set the appearance
  6. Documentation
  7. License

@sckyzo/cosmos-theme

npm

Cosmos design tokens, CSS only: a Tailwind 4 @theme block, four themes, twelve accents, six fonts, and text size, density and corner radius settings. It is what @sckyzo/cosmos-react and @sckyzo/cosmos-charts are styled with, and it works on its own in any framework.

ImportPurpose
@sckyzo/cosmos-theme/tailwindTailwind 4 @theme block (palette, fonts, shadows, brand colors), the dark: and rtl: variants, the focus utilities
@sckyzo/cosmos-theme/varsThe CSS custom properties (bg, text, border, accent), the themes and the accents
@sckyzo/cosmos-theme/fonts@fontsource font imports (Outfit + JetBrains Mono)
@sckyzo/cosmos-theme/fonts/<name>One variable font for data-font: inter, plex, montserrat, open-sans

Install

npm install @sckyzo/cosmos-theme

The three Cosmos packages share one version number: install the same version of each.

Usage

Import order matters: tailwindcss comes first, then the Cosmos tokens, then the vars.

/* src/index.css */
@import 'tailwindcss';
@import '@sckyzo/cosmos-theme/tailwind';
@import '@sckyzo/cosmos-theme/vars';
@import '@sckyzo/cosmos-theme/fonts';

With @sckyzo/cosmos-react, also add an @source line so Tailwind scans the components: see Getting started.

Without Tailwind (e.g. Docusaurus)

@import '@sckyzo/cosmos-theme/fonts';
@import '@sckyzo/cosmos-theme/vars';
/* Then reference vars: var(--color-brand-500), var(--color-bg-base), etc. */

Set the appearance

The theme is one class on <html>; the accent, the font, the text size, the density and the corner radius are data-accent, data-font, data-text-size, data-density and data-radius attributes, and the reading direction is the native dir.

<html class="sand" data-accent="teal"></html>

Documentation

License

MIT, see LICENSE.

版本与发布记录

@sckyzo/cosmos-theme 共发布 9 个版本,首次发布于 2026/05/21;过去 12 个月发布了 9 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.6.0latest2026/11/021 天前
0.5.02026/11/012 天前
0.4.12026/11/012 天前
0.4.02026/10/313 天前
0.3.02026/10/277 天前
0.2.02026/10/2212 天前

关于 @sckyzo/cosmos-theme 的常见问题

@sckyzo/cosmos-theme 是什么?

宇宙设计系统的顺风4主题和设计令牌-调色板,排版,半径和CSS变量为其浅色,沙子,深色和深蓝色主题。

如何安装 @sckyzo/cosmos-theme?

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

@sckyzo/cosmos-theme 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/sckyzo__cosmos-theme 是否存在。

@sckyzo/cosmos-theme 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@sckyzo/cosmos-theme 可以商用吗?

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

@sckyzo/cosmos-theme 还在维护吗?

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