@theme-kit/cli
CLI Overview
# npm — `-g` is npm's global-install flag (pnpm: `pnpm add --global`, yarn: `yarn global add`)
npm install -g @theme-kit/cli
theme-kit --helpWhy a CLI?
Theme Kit has two audiences, and they need different interfaces:
- Applications depend on the runtime packages —
@theme-kit/core,@theme-kit/react,@theme-kit/next, the adapters — at build time and run. - Developers and build pipelines operate on the theme files themselves — create, check, inspect, migrate, and export them — without opening an editor.
The CLI is a standalone developer tool for that second audience. It doesn't run in your app; you run it when you author or maintain a theme.
How a theme moves through the CLI
1Seed color
2 ↓
3generateTheme ──→ theme.json
4 ↓
5validateTheme ──→ schema + tokens + contrast
6 ↓
7inspect ──→ what is inside this theme?
8 ↓
9use in the runtime ── @theme-kit/core provider
10 ↓
11migrate ── when the theme schema changes
12 ↓
13export ── CSS variables / JSON for another systemPackage vs. command
| npm package | terminal command |
|---|---|
@theme-kit/cli | theme-kit |
The package is installed globally, and the packager links the theme-kit
executable into your shell's bin directory. You type theme-kit, not
@theme-kit/cli.
Prerequisites
- Node.js 22+ (any modern release). No browser package is needed.
- A plain JSON theme file. A file is either a pair
(
{ "light": …, "dark": … }, generated by--mode both) or a single theme ({ "name", "meta", "tokens" }, from--mode light|dark).
Every command at a glance
| Command | What it does |
|---|---|
theme-kit generate | Derive a theme from a seed color |
theme-kit validate | Check a theme against the schema and contrast |
theme-kit inspect | Print a theme's structure and token groups |
theme-kit migrate | Migrate a legacy theme to the current format |
theme-kit export | Export theme tokens to CSS variables or JSON |
What the CLI does not do
The CLI is deliberately file-oriented: it reads a theme, prints, and exits. It has no config files, no daemon, no editor, and no implicit workspace — the only "opinion" is the JSON theme format it reads and writes.
Next: Installation, or jump straight to a Quick Start workflow.