From claude-code-skills
Analyze, audit, and optimize the project's color palette. Detects inconsistencies, generates harmonious palettes with dark mode mapping, and outputs Tailwind config. Use when the user says "color palette", "analyze colors", "fix colors", "color audit", or "generate palette".
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-code-skills:color-paletteThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyze, audit, and optimize the color usage in a TailwindCSS project. Detects inconsistencies, suggests improvements, and can generate a complete harmonious palette with dark mode mapping.
Analyze, audit, and optimize the color usage in a TailwindCSS project. Detects inconsistencies, suggests improvements, and can generate a complete harmonious palette with dark mode mapping.
Parse $ARGUMENTS to determine the action:
| Argument | Action |
|---|---|
(empty) or analyze | Audit current color usage and report issues |
generate [style] | Generate a new palette from scratch |
harmonize | Fix inconsistencies in the existing palette |
export | Output the current/improved palette as Tailwind config |
Scan the project for all color usage and produce a detailed report.
Step 1: Read Tailwind config
Glob for tailwind.config.* and read it. Look for:
theme.colors (full override)theme.extend.colors (extensions)primary, secondary, accent)Step 2: Scan color class usage
Grep: (bg|text|border|ring|shadow|from|via|to|accent|fill|stroke)-(slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(\d{2,3})
Glob: *.{html,jsx,tsx,vue,svelte,astro}
head_limit: 100
Step 3: Count and categorize
Build a usage map:
Color | Occurrences | Used as
blue-600 | 23 | bg (buttons), text (links), ring (focus)
blue-500 | 8 | bg (hover), ring (focus)
gray-50 | 15 | bg (surface)
gray-100 | 12 | bg (hover)
...
## 🎨 Color Palette Analysis
### Current Palette
| Role | Color | Shade Range | Occurrences |
|------|-------|-------------|-------------|
| Primary | blue | 500-700 | 45 |
| Neutral | gray | 50-900 | 89 |
| Accent | emerald | 400-600 | 12 |
| Destructive | red | 500-600 | 8 |
### 🔴 Issues Found
#### Inconsistent Primary Color
- `blue-500` used as primary in 8 places
- `blue-600` used as primary in 23 places
- `indigo-600` used as primary in 3 places
→ **Fix:** Standardize on `blue-600` as primary, `blue-700` for hover
#### Missing Dark Mode Colors
- 34 color classes lack `dark:` variants
- Worst offenders: {list top 5 files}
#### Too Many Gray Variants
- Using both `gray-100` and `gray-50` for the same purpose (surface bg)
→ **Fix:** Consolidate to `gray-50` for surfaces, `gray-100` for hover
#### Accessibility Contrast Issues
- `text-gray-400` on `bg-white` fails WCAG AA (3.6:1, needs 4.5:1)
→ **Fix:** Use `text-gray-500` or darker (4.6:1+)
### ✅ What's Good
{positive observations}
### 📋 Recommended Palette
{optimized palette table — see below}
Generate a complete new color palette. Parse the style from arguments:
/color-palette generate → Default modern SaaS palette
/color-palette generate warm → Warm tones (amber, orange, rose)
/color-palette generate cool → Cool tones (sky, blue, slate)
/color-palette generate earthy → Earthy/natural (stone, emerald, amber)
/color-palette generate vibrant → Bold/saturated (violet, fuchsia, cyan)
/color-palette generate monochrome → Single hue + neutrals
/color-palette generate brand #3B82F6 → Build palette around a specific brand color
Every generated palette must include:
## Generated Palette
| Role | Light Mode | Dark Mode | Usage |
|------|-----------|-----------|-------|
| **Primary** | {color}-600 | {color}-500 | Buttons, links, active states |
| **Primary Hover** | {color}-700 | {color}-400 | Button hover, link hover |
| **Primary Light** | {color}-50 | {color}-950 | Subtle backgrounds, badges |
| **Secondary** | {color2}-600 | {color2}-500 | Secondary actions |
| **Accent** | {color3}-500 | {color3}-400 | Highlights, indicators |
| **Destructive** | red-600 | red-500 | Delete, error states |
| **Warning** | amber-500 | amber-400 | Warning states |
| **Success** | emerald-600 | emerald-500 | Success states |
| **Neutral BG** | white | {gray}-950 | Page background |
| **Surface** | {gray}-50 | {gray}-900 | Card/panel background |
| **Surface Hover** | {gray}-100 | {gray}-800 | Hover on surfaces |
| **Elevated** | white | {gray}-800 | Elevated panels, modals |
| **Border** | {gray}-200 | {gray}-700 | Borders, dividers |
| **Text Primary** | {gray}-900 | {gray}-100 | Headings, body text |
| **Text Secondary** | {gray}-600 | {gray}-400 | Descriptions, labels |
| **Text Muted** | {gray}-400 | {gray}-500 | Placeholders, captions |
gray, slate, zinc, neutral, or stone — use only that one across the entire project.*-950 base → *-900 surface → *-800 elevated).Fix inconsistencies in the existing palette without changing the overall look:
indigo-600 → blue-600)## Harmonization Plan
### Changes (safe — no visual regression)
- [x] `text-gray-400` → `text-gray-500` (5 files — contrast fix)
- [x] Remove `gray-100` usage → use `gray-50` (3 files — consolidation)
### Changes (minor visual change)
- [ ] `indigo-600` → `blue-600` in 3 files (align with primary)
- [ ] `shadow-blue-400/20` → `shadow-blue-500/25` (align with primary)
### Dark Mode Additions Needed
- [ ] src/components/Card.tsx — 6 classes missing `dark:` variants
- [ ] src/components/Sidebar.tsx — 4 classes missing `dark:` variants
Present the plan and ask the user before applying changes.
Output the palette in formats the user can directly use:
// tailwind.config.js — paste into theme.extend.colors
colors: {
primary: {
50: '#eff6ff', // blue-50
100: '#dbeafe', // blue-100
500: '#3b82f6', // blue-500
600: '#2563eb', // blue-600
700: '#1d4ed8', // blue-700
},
surface: {
light: '#f9fafb', // gray-50
DEFAULT: '#ffffff',
dark: '#030712', // gray-950
},
// ... full mapping
}
:root {
--color-primary: theme('colors.blue.600');
--color-primary-hover: theme('colors.blue.700');
--color-surface: theme('colors.gray.50');
/* ... */
}
.dark {
--color-primary: theme('colors.blue.500');
--color-primary-hover: theme('colors.blue.400');
--color-surface: theme('colors.gray.900');
/* ... */
}
If design-system.md exists, offer to update its ## Colors section with the exported palette.
Minimum contrast ratios (WCAG 2.1 AA):
| Type | Ratio | Example |
|---|---|---|
| Normal text | 4.5:1 | text-gray-600 on white = 5.4:1 ✅ |
| Large text (18px+ bold / 24px+) | 3:1 | text-gray-500 on white = 4.6:1 ✅ |
| UI components | 3:1 | border-gray-300 on white = 3.2:1 ✅ |
Common TailwindCSS contrast traps:
| Combo | Ratio | Verdict |
|---|---|---|
text-gray-400 on bg-white | 3.6:1 | ❌ Fail AA |
text-gray-500 on bg-white | 4.6:1 | ✅ Pass AA |
text-gray-400 on bg-gray-900 | 4.2:1 | ❌ Fail AA |
text-gray-500 on bg-gray-900 | 3.4:1 | ❌ Fail AA |
text-gray-400 on bg-gray-950 | 4.8:1 | ✅ Pass AA |
npx claudepluginhub markbenz/claude-code-skills --plugin claude-code-skillsGenerates accessible color palettes from brand hex: 11-shade scales (50-950), semantic tokens, dark mode variants, Tailwind v4 CSS, WCAG contrast checks. For design systems and themes.
Generates color palettes with Tailwind-scale shades (50–950) from hex inputs using OKLCH color space. Supports color wheel strategies (triadic, complementary, etc.) and mood flags (vibrant, pastel).
Builds accessible color systems with palettes, semantic mappings, tonal scales, and contrast checks for UI components in digital products.