Skip to content

@theme-kit/cli

CLI Overview

bash
# npm — `-g` is npm's global-install flag (pnpm: `pnpm add --global`, yarn: `yarn global add`)
npm install -g @theme-kit/cli
theme-kit --help

Why 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

text
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 system

Package vs. command

npm packageterminal command
@theme-kit/clitheme-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

CommandWhat it does
theme-kit generateDerive a theme from a seed color
theme-kit validateCheck a theme against the schema and contrast
theme-kit inspectPrint a theme's structure and token groups
theme-kit migrateMigrate a legacy theme to the current format
theme-kit exportExport 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.

CLI Overview — Theme Kit