Colors v0.1.0

CLI Reference

The @sveltopia/colors CLI generates palettes from the command line or interactively. Run it with npx — no install needed.

generate

Generates a complete color palette from your brand colors. Run without flags for interactive mode, or pass flags for scripted usage:

bash
# Interactive — prompts for colors, format, and output directory
npx @sveltopia/colors generate

# Flag-based — for scripts and CI
npx @sveltopia/colors generate --colors "#FF4F00,#1A1A1A" --format tailwind,shadcn

Flags

FlagAliasDescriptionDefault
--colors-cComma-separated hex colors (up to 7)interactive
--format-fOutput formats: css, json, tailwind, tailwind-v3, radix, panda, shadcn, allcss,json
--output-oOutput directory./colors
--configPath to config filecolors.config.json
--prefix-pCSS variable prefix (e.g., my- for --my-red-9)none
--verbose-vShow tuning profile, anchors, and custom rowsfalse
--dry-runPreview output without writing filesfalse

Generated files

Depending on the formats you choose, the CLI writes these files to your output directory:

FormatFileDescription
csscolors.cssCSS custom properties for all scales
jsoncolors.jsonStructured JSON with hex, OKLCH, and P3 formats
tailwindtailwind.cssTailwind v4 CSS with @theme block (50–950 scale)
tailwind-v3tailwind.preset.jsTailwind v3 JS preset (50–950 scale)
shadcnshadcn-colors.cssshadcn/ui compatible CSS variables
radixradix-colors.jsRadix Colors compatible JS export
pandapanda.preset.tsPanda CSS preset

Config file

Instead of passing flags every time, create a colors.config.json in your project root:

colors.config.json
{
  "brandColors": ["#FF4F00", "#1A1A1A"],
  "outputDir": "./colors",
  "formats": ["css", "json", "tailwind"],
  "prefix": ""
}

Then run npx @sveltopia/colors generate with no flags — the CLI reads the config automatically.

dev

Starts an interactive dev server where you can preview and tweak your palette in real time.

bash
npx @sveltopia/colors dev

# Or with brand colors pre-loaded
npx @sveltopia/colors dev --colors "#FF4F00"

Flags

FlagAliasDescriptionDefault
--colors-cComma-separated hex colorsinteractive
--configPath to config filecolors.config.json
--port-pDev server port3000
--no-openDon't auto-open browserfalse

Interactive vs flag-based

The CLI supports two workflows:

Flag-based (CI/scripts)

Pass all options as flags for reproducible, scriptable generation:

bash
npx @sveltopia/colors generate -c "#FF4F00,#2563EB" -f tailwind,shadcn -o ./src/colors

Interactive (first-time setup)

Run without flags and the CLI prompts you through each decision:

bash
npx @sveltopia/colors generate

? Enter your brand colors (hex, comma-separated):
> #FF4F00, #1A1A1A

? Select output formats:
> css, json, tailwind

? Output directory:
> ./colors

Tip: Use --dry-run with flag-based mode to preview what files will be generated before writing anything to disk.