chromaui/chromatic-skills/chromatic-themes
Claude Code and agent skill by chromaui/chromatic-skills
- community
- ext:[{"type":"plugin","description":"Custom plugin integration"}]
Checking that the SKILL.md file is still in the repository.
Configure Chromatic to capture visual test snapshots across multiple themes (light/dark mode, design tokens, branded variants) using the Modes API and @storybook/addon-themes. Use when the user wants to test components with different themes in Chromatic, set up light/dark mode visual testing, configure @storybook/addon-themes with Chromatic, or apply theme modes at the project, component, or story level.
Install
npx vskill@latest install chromaui/chromatic-skills/chromatic-themesSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Chromatic Themes
Configure multi-theme visual testing using Chromatic's Modes API and @storybook/addon-themes.
This skill covers:
- Detecting the user's theme library and configuring the right decorator
- Defining theme modes in
.storybook/modes.ts - Applying modes at project, component, and story levels
Quick start
- Scan the project for existing theme config: look for
@storybook/addon-themesimports, amodes.tsfile, orchromatic.modes. - Ask the user which theme library they use (see step 3 below).
- Fetch the relevant docs from
reference/docs-map.md. - Generate configuration files and output the checklist from
reference/output-contract.md.
Required workflow
1) Detect existing configuration
Check .storybook/preview.ts, story files, and any modes.ts:
withThemeByClassNameorwithThemeByDataAttributefound → addon already configured, help extend or wire up modeschromatic.modeswiththemekeys found → already on Modes API, help extend or fix- Neither found → fresh setup, ask the user which theme library they use
2) Fetch current docs
Use the URLs in reference/docs-map.md and fetch with WebFetch. Use fetched content as the authoritative source — do not rely on remembered examples.
3) Install @storybook/addon-themes (fresh setup only)
If @storybook/addon-themes is not already installed, detect the package manager by checking for lock files (bun.lockb/bun.lock → bun, pnpm-lock.yaml → pnpm, yarn.lock → yarn, package-lock.json → npm) and use the matching install command:
| Package manager | Command | |
|---|---|---|
| npm | npm install --save-dev @storybook/addon-themes | |
| yarn | yarn add --dev @storybook/addon-themes | |
| pnpm | pnpm add --save-dev @storybook/addon-themes | |
| bun | bun add --dev @storybook/addon-themes |
Then register it in .storybook/main.ts:
4) Identify the theme library and configure the decorator
Ask: _"Which theme library or approach does your project use? (e.g. Tailwind, Bootstrap, Material UI, styled-components, Emotion, or plain CSS classes)"_
Use the answer to pick the right path:
| Library | Decorator | Docs to fetch | |
|---|---|---|---|
| Tailwind, plain CSS classes | withThemeByClassName | themes.txt | |
| Bootstrap | withThemeByDataAttribute (data-bs-theme) | getting-started/bootstrap.md | |
| Material UI | custom decorator | getting-started/material-ui.md | |
| styled-components | custom decorator | getting-started/styled-components.md | |
| Emotion | custom decorator | getting-started/emotion.md | |
| Other / unsure | withThemeByClassName | themes.txt |
Class-based (withThemeByClassName):
Data attribute (withThemeByDataAttribute):
Custom decorator — fetch the library-specific guide from reference/docs-map.md and follow it. Use pluckThemeFromContext and initializeThemeState from @storybook/addon-themes to bridge Storybook globals with the library's theme API.
4) Define theme modes
Create or update .storybook/modes.ts. The theme key must exactly match a key in the decorator's themes object:
5) Apply modes to stories
Project-wide (.storybook/preview.ts):
Per component or per story:
Disable inherited modes on a specific story:
6) Output checklist
Always render the checklist from reference/output-contract.md, then show the complete content of every file to create or modify.
Key constraints
- The
themevalue in a mode must exactly match a key in the decorator'sthemesobject — a mismatch silently falls back to the default theme - Mode names are tied to baselines — renaming a mode creates a new baseline and retires the old one
- Modes stack across project → component → story levels; lower levels add to higher ones, they do not replace them
@storybook/addon-themesrequires Storybook 7.x or later- Only one decorator approach per project — do not mix
withThemeByClassNameandwithThemeByDataAttribute
Boundaries
- Do not commit or push files — generate and show configuration only
- Do not suggest viewport or locale modes unless the user asks
- Do not install or suggest theme libraries — only wire up what already exists
References
reference/docs-map.mdreference/output-contract.md../chromatic-setup-ci/reference/package-manager.md— lock file detection and install commands per package manager
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/chromatic-themes/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
pluginCustom plugin integration
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/chromaui/chromatic-skills/chromatic-themes)