Skip to main content
command CX Codex

theme-swap — Claude Code command: recolor a site

theme-swap recolors an extracted site around a new primary hue while leaving neutrals, type, spacing, and motion unchanged. Useful for checking a brand color.

MIT ★ 5,183 updated 2026-10-23

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add Manavarya09/design-extract
/plugin install designlang@designlang
Open on GitHub

What theme-swap does

The command takes an extracted site URL and a target HEX value through --primary. It rotates the palette in OKLCH while keeping perceptual lightness intact. Neutral and structural tokens stay as they are, along with typography, spacing, and motion.

Files are written to ./design-extract-output/: a side-by-side HTML preview, a Markdown change table, JSON deltas, and a DTCG token file. The token output can be used in an existing Tailwind or shadcn project. --primary is required; --from lets you replace the detected source color when the extractor picked the wrong one.

Use --open to launch the HTML preview in the default browser. --format selects the output types and --out changes the destination directory. If the URL or primary color is missing, the command asks for it.

What it helps with

  • replace an extracted site's main brand color
  • compare the original and recolored HTML
  • review palette changes in a Markdown table
  • export tokens for Tailwind or shadcn

Example prompts for the agent

  • Run /designlang:theme-swap <url> --primary "#ff4800" to recolor the extracted site around #ff4800.
  • Use --from "#111111" when the detected source primary is wrong.
  • Create the recolored files and open the preview with /designlang:theme-swap <url> --primary "#ff4800" --open.

How to install theme-swap

1Plugin marketplace

/plugin marketplace add Manavarya09/design-extract
/plugin install designlang@designlang

2Manually: put the files in place

.claude/commands/theme-swap.md

Call it with /theme-swap. For all projects use ~/.claude/commands/

Questions about theme-swap

How do I install theme-swap in Claude Code?

Run /plugin marketplace add Manavarya09/design-extract, then /plugin install designlang@designlang, and add .claude/commands/theme-swap.md.

What does theme-swap do?

It rotates an extracted site's brand palette toward a supplied primary color and writes a preview, change report, JSON deltas, and DTCG tokens.

When should I use --from?

Use it to set the original primary manually when automatic color detection selected the wrong source color.

Source text

theme-swap.md · MIT
---
description: Recolour an extracted site's design around a new brand primary. OKLCH hue rotation preserves perceptual lightness — neutrals, type, spacing, and motion stay untouched. Side-by-side HTML preview + recoloured tokens (DTCG, Tailwind, shadcn, Figma).
argument-hint: <url> --primary <hex>  [--from <hex>] [--open]
---

Take any extracted site and swap its brand primary to the user-provided hex. The whole palette rotates around that hue while neutrals and structural tokens stay put.

```bash
npx designlang theme-swap $ARGUMENTS
```

If `$ARGUMENTS` doesn't contain both a URL and `--primary <hex>`, ask the user for the missing piece.

After the run completes, all output goes to `./design-extract-output/`:

- `*.themeswap.html` — editorial side-by-side preview (open this)
- `*.themeswap.md` — markdown diff table
- `*.themeswap.json` — structured before→after deltas
- `*.themeswap.tokens.json` — recoloured DTCG token set you can drop into a project

After the command finishes:

1. Read `*.themeswap.md` to summarise the swap (`from → to`, hue shift, count of changed colours).
2. Show the user the verdict line ("X colours changed, neutrals preserved, type/spacing/motion untouched").
3. Offer to open the HTML preview (`--open` does this automatically).
4. Suggest the recoloured token files as drop-ins for an existing Tailwind / shadcn project.

## Useful flags

| Flag | Effect |
|---|---|
| `--primary <hex>` | **required.** Target brand colour (e.g. `"#ff4800"`). |
| `--from <hex>` | Override the auto-detected source primary when the extractor misclassifies (e.g. a neutral got promoted by usage count). |
| `--format html\|md\|json\|tokens\|all` | Pick the output(s). Default `all`. |
| `--out <dir>` | Output directory. Default `./design-extract-output`. |
| `--open` | Open the HTML preview in your default browser. |

## Pairs nicely with

- `/grade <url>` — grade the recoloured site by feeding the same target through `/extract` then `/grade`.
- `/pack <url>` — bundle the recoloured tokens as a downloadable design-system folder.
- `/remix <url> --as <vocab>` — full vocabulary swap (brutalist, art-deco, cyberpunk…) instead of just brand colour.

© Manavarya Singh · MIT · Manavarya09/design-extract

Similar slash commands

All slash commands for Frontend and UI →

From the same set16

The whole set →

Project sponsors

Companies that keep this analytics open