Theme Factory
Purpose
Generate cohesive, beautiful UI themes when no design specifications provided, preventing generic monotone interfaces.
Core Principle
Brand personality drives design decisions.
Every UI communicates personality through color, typography, and style. Rather than defaulting to arbitrary colors, ask about brand personality first, then generate cohesive themes that match.
Good theme = Intentional, cohesive, personality-aligned
Bad theme = Random colors, inconsistent, no personality
When to Use Theme Factory
Use when user EXPLICITLY asks for theme help:
- "What theme should I use?"
- "Help me pick colors"
- "What colors work well together?"
- User uncertain about aesthetic choices
Don't use if:
- User has clear aesthetic in mind → design-fundamentals handles it
- Figma file/URL provided → use figma-design-extraction
- User already chose colors/fonts → just apply them
Theme Selection Process
Step 1: Understand Brand Personality
Ask user (concise, 1-2 questions max):
Question 1: "What personality should this UI have?"
- Professional - Corporate, trustworthy, business-focused
- Creative - Bold, artistic, unique, expressive
- Minimal - Clean, sophisticated, simple, timeless
- Bold/Tech - Modern, eye-catching, innovative
- Warm/Organic - Natural, welcoming, friendly
- Playful - Fun, colorful, approachable, energetic
Question 2: "Any color preferences or inspirations?"
- Specific colors they like
- Competitor/inspiration URLs
- Or: "Auto-generate based on personality"
Step 2: Present Theme Options
Show 2-3 pre-defined themes from .agents/themes/ matching personality
Example:
1. Professional Blue - Corporate, trustworthy, clean
2. Minimal Monochrome - Sophisticated, timeless
3. Generate custom theme based on your preferences
If user wants custom: Generate based on personality + color preferences
Theme Anatomy
1. Colors
Primary Palette (shades 50-900):
- Used for: Main actions, links, buttons, key UI elements
- Scale: 50 (lightest) → 900 (darkest)
Neutral Palette (50-900):
- Used for: Text, backgrounds, borders, subtle UI
- Principle: True grays or slightly tinted toward primary
Semantic Colors:
- Success: Green (growth, positive, confirmation)
- Warning: Yellow/orange (caution, attention)
- Error: Red (danger, mistakes, destructive)
- Info: Blue (information, neutral)
Why this structure:
- Full palette enables light/dark modes
- Semantic colors ensure accessibility
- Neutrals provide visual breathing room
Dark Mode Variant
Derive dark palette from the same hue — don't invent new colors.
| Role |
Light mode |
Dark mode |
| Page background |
neutral-50 |
neutral-950 |
| Surface (card/panel) |
neutral-100 |
neutral-900 |
| Surface hover |
neutral-200 |
neutral-800 |
| Body text |
neutral-700 |
neutral-200 |
| Heading text |
neutral-900 |
neutral-50 |
| Border |
neutral-200 |
neutral-700 |
| Primary action |
primary-600 |
primary-400 |
| Primary text on surface |
primary-700 |
primary-300 |
Key rules:
- Primary hue stays the same — only shift lightness (600→400 for dark)
- Semantic colors (success/error/warning) lighten ~100-200 steps in dark mode
- Never use the same shade for both modes — always invert the scale direction
2. Typography
See design-fundamentals for typography pairing principles.
Theme should define:
- Font families (heading + body)
- Type scale values
- Font weights available
- Line heights
3. Spacing System
See design-fundamentals for spacing scale principles.
Theme should define:
- Base unit (4px or 8px)
- Scale values
4. Visual Properties
Border Radius:
- Minimal: Small or none (sharp, clean)
- Friendly: Medium roundness (approachable, soft)
- Playful: Large roundness or full pill shapes (fun, organic)
Shadows:
- Subtle shadows for depth (professional, minimal)
- Stronger shadows for cards/modals (modern, bold)
- No shadows for flat design (minimalist)
- Define elevation system (subtle/medium/strong)
Contrast Check
WCAG AA minimums (required):
- Normal text (< 18px): 4.5:1
- Large text (≥ 18px bold / ≥ 24px): 3:1
- UI components (buttons, inputs, icons): 3:1
Must-check pairs for every theme:
| Pair |
Target |
Common failure |
| Body text on page background |
4.5:1 |
Light gray text on white |
| Heading on page background |
4.5:1 |
Medium neutral on light neutral |
| White text on primary button |
4.5:1 |
Light primaries (yellow, lime) |
| Primary text on white |
4.5:1 |
Mid-range primaries (400-500) |
| Placeholder text on input |
3:1 |
neutral-400 on white |
Quick mental check — the 4.5:1 rule of thumb:
- Dark text on light bg: text must be ≤ neutral-600 on neutral-50
- Light text on dark bg: text must be ≥ neutral-200 on neutral-900
- Primary-500 on white usually fails — use primary-600 or darker for text/icons
If primary color is light (yellow, lime, teal-300):
- Never use as button background with white text → use dark text instead
- Or shift to primary-700 for text, primary-600 for buttons
Color Theory Foundations
Color Harmony Methods
Complementary - Opposites on color wheel:
- High contrast, energetic, bold
- Example: Blue + Orange, Red + Green
- Use for: Bold, tech, creative personalities
Analogous - Adjacent on color wheel:
- Harmonious, calm, cohesive
- Example: Blue + Purple + Teal
- Use for: Professional, minimal, warm personalities
Triadic - Three evenly spaced:
- Balanced, vibrant, dynamic
- Example: Red + Yellow + Blue
- Use for: Playful, creative personalities
Monochromatic - Single hue, varying lightness:
- Clean, sophisticated, minimal
- Use for: Minimal, professional personalities
Color Psychology
Quick reference:
- Blue = Trust, professional
- Green = Growth, health
- Purple = Creativity, luxury
- Red = Energy, urgency
- Orange = Friendly, energetic
- Yellow = Optimism, playfulness
- Neutral = Sophisticated, minimal
When choosing colors:
- Consider brand personality
- Use color harmony methods for cohesive palettes
- Verify contrast ratios meet WCAG AA
Theme Documentation Format
In planning doc:
## Theme Specification
### Selected Theme
- Name: [Theme Name]
- Source: .agents/themes/[filename].theme.json OR "Custom generated"
- Personality: [personality traits]
### Color Palette
**Primary ([Color Name]):**
- Base: [hex] (buttons, links, actions)
- Hover: [hex]
- Active: [hex]
- Full scale: 50-900 shades
**Neutral:**
- Lightest: [hex] (backgrounds)
- Medium: [hex] (body text)
- Darkest: [hex] (headings)
- Full scale: 50-900 shades
**Semantic:**
- Success: [hex] / dark: [hex]
- Error: [hex] / dark: [hex]
- Warning: [hex] / dark: [hex]
- Info: [hex] / dark: [hex]
### Dark Mode Palette
- Background: [hex] (neutral-950)
- Surface: [hex] (neutral-900)
- Body text: [hex] (neutral-200)
- Heading: [hex] (neutral-50)
- Border: [hex] (neutral-700)
- Primary action: [hex] (primary-400)
### Contrast Verification
- Body text / background: [ratio]:1 ✓/✗
- White / primary button: [ratio]:1 ✓/✗
- Primary text / white: [ratio]:1 ✓/✗
### Typography
- Heading: [Font family], [weight], [line-height]
- Body: [Font family], [weight], [line-height]
- Scale: [values]
### Spacing
- Scale: [values - base-4 or base-8]
### Visual Style
- Border radius: [small/medium/large]
- Shadows: [subtle/medium/strong]
Theme Application Guidelines
Consistency Rules:
Do:
- Use only colors from theme palette
- Apply spacing scale consistently
- Follow typography scale
- Use semantic colors for their intended purpose
Don't:
- Mix colors from multiple themes
- Use arbitrary values
- Override theme for one-off styles
- Ignore semantic color meanings
Component Theming:
Buttons:
- Primary: Primary color background
- Secondary: Secondary/neutral background
- Outline: Transparent background, primary border
- Ghost: Transparent, primary text only
States:
- Hover: Slightly darker/more saturated
- Active: Noticeably darker than hover
- Disabled: Muted neutral shades
- Focus: Primary color ring
Common Mistakes
- No personality - Generic theme
→ Fix: Choose personality first
- Arbitrary tweaks - Modifying theme colors slightly
→ Fix: Use theme palette exactly as defined
- Semantic color abuse - Green button for delete
→ Fix: Red (error) for destructive, green (success) for positive
- Ignoring color harmony - Random combinations
→ Fix: Use color harmony methods
- Theme mixing - Using colors from multiple themes
→ Fix: Commit to one theme
- Copying examples literally - Using exact values from docs
→ Fix: Generate unique values matching personality
Validation Checklist
Key Takeaway
Color harmony + brand personality = cohesive themes.
When users need help choosing colors/fonts:
- Ask brand personality
- Apply color harmony methods
- Generate complete theme specification
- Apply using design-fundamentals principles
Theme-factory provides interactive selection and color theory methods.
Design-fundamentals provides application principles and technical foundation.
Together: Distinctive, cohesive, accessible UI themes.
1---2name: frontend-design-theme-factory3description: |4 Theme/color selection when user has no aesthetic direction and wants agent to decide.5 Use when: user is uncertain — "suggest colors", "what theme", "help me choose", "you pick".6 Keywords: suggest theme, suggest colors, what theme, what colors, help choose, help pick, no direction, you choose, recommend colors7 Do NOT use for: user has colors/style in mind, applying existing theme.8---910# Theme Factory1112## Purpose13Generate cohesive, beautiful UI themes when no design specifications provided, preventing generic monotone interfaces.1415---1617## Core Principle1819**Brand personality drives design decisions.**2021Every UI communicates personality through color, typography, and style. Rather than defaulting to arbitrary colors, ask about brand personality first, then generate cohesive themes that match.2223**Good theme** = Intentional, cohesive, personality-aligned24**Bad theme** = Random colors, inconsistent, no personality2526---2728## When to Use Theme Factory2930**Use when user EXPLICITLY asks for theme help:**31- "What theme should I use?"32- "Help me pick colors"33- "What colors work well together?"34- User uncertain about aesthetic choices3536**Don't use if:**37- User has clear aesthetic in mind → design-fundamentals handles it38- Figma file/URL provided → use figma-design-extraction39- User already chose colors/fonts → just apply them4041---4243## Theme Selection Process4445### Step 1: Understand Brand Personality4647**Ask user (concise, 1-2 questions max):**4849**Question 1: "What personality should this UI have?"**50- **Professional** - Corporate, trustworthy, business-focused51- **Creative** - Bold, artistic, unique, expressive52- **Minimal** - Clean, sophisticated, simple, timeless53- **Bold/Tech** - Modern, eye-catching, innovative54- **Warm/Organic** - Natural, welcoming, friendly55- **Playful** - Fun, colorful, approachable, energetic5657**Question 2: "Any color preferences or inspirations?"**58- Specific colors they like59- Competitor/inspiration URLs60- Or: "Auto-generate based on personality"6162### Step 2: Present Theme Options6364**Show 2-3 pre-defined themes from `.agents/themes/` matching personality**6566Example:67```681. Professional Blue - Corporate, trustworthy, clean692. Minimal Monochrome - Sophisticated, timeless703. Generate custom theme based on your preferences71```7273**If user wants custom:** Generate based on personality + color preferences7475---7677## Theme Anatomy7879### 1. Colors8081**Primary Palette (shades 50-900):**82- Used for: Main actions, links, buttons, key UI elements83- Scale: 50 (lightest) → 900 (darkest)8485**Neutral Palette (50-900):**86- Used for: Text, backgrounds, borders, subtle UI87- Principle: True grays or slightly tinted toward primary8889**Semantic Colors:**90- Success: Green (growth, positive, confirmation)91- Warning: Yellow/orange (caution, attention)92- Error: Red (danger, mistakes, destructive)93- Info: Blue (information, neutral)9495**Why this structure:**96- Full palette enables light/dark modes97- Semantic colors ensure accessibility98- Neutrals provide visual breathing room99100### Dark Mode Variant101102**Derive dark palette from the same hue — don't invent new colors.**103104| Role | Light mode | Dark mode |105|------|-----------|-----------|106| Page background | neutral-50 | neutral-950 |107| Surface (card/panel) | neutral-100 | neutral-900 |108| Surface hover | neutral-200 | neutral-800 |109| Body text | neutral-700 | neutral-200 |110| Heading text | neutral-900 | neutral-50 |111| Border | neutral-200 | neutral-700 |112| Primary action | primary-600 | primary-400 |113| Primary text on surface | primary-700 | primary-300 |114115**Key rules:**116- Primary hue stays the same — only shift lightness (600→400 for dark)117- Semantic colors (success/error/warning) lighten ~100-200 steps in dark mode118- Never use the same shade for both modes — always invert the scale direction119120---121122### 2. Typography123124**See design-fundamentals for typography pairing principles.**125126Theme should define:127- Font families (heading + body)128- Type scale values129- Font weights available130- Line heights131132### 3. Spacing System133134**See design-fundamentals for spacing scale principles.**135136Theme should define:137- Base unit (4px or 8px)138- Scale values139140### 4. Visual Properties141142**Border Radius:**143- **Minimal**: Small or none (sharp, clean)144- **Friendly**: Medium roundness (approachable, soft)145- **Playful**: Large roundness or full pill shapes (fun, organic)146147**Shadows:**148- Subtle shadows for depth (professional, minimal)149- Stronger shadows for cards/modals (modern, bold)150- No shadows for flat design (minimalist)151- Define elevation system (subtle/medium/strong)152153---154155## Contrast Check156157**WCAG AA minimums (required):**158- Normal text (< 18px): **4.5:1**159- Large text (≥ 18px bold / ≥ 24px): **3:1**160- UI components (buttons, inputs, icons): **3:1**161162**Must-check pairs for every theme:**163164| Pair | Target | Common failure |165|------|--------|---------------|166| Body text on page background | 4.5:1 | Light gray text on white |167| Heading on page background | 4.5:1 | Medium neutral on light neutral |168| White text on primary button | 4.5:1 | Light primaries (yellow, lime) |169| Primary text on white | 4.5:1 | Mid-range primaries (400-500) |170| Placeholder text on input | 3:1 | neutral-400 on white |171172**Quick mental check — the 4.5:1 rule of thumb:**173- Dark text on light bg: text must be ≤ neutral-600 on neutral-50174- Light text on dark bg: text must be ≥ neutral-200 on neutral-900175- Primary-500 on white usually **fails** — use primary-600 or darker for text/icons176177**If primary color is light (yellow, lime, teal-300):**178- Never use as button background with white text → use dark text instead179- Or shift to primary-700 for text, primary-600 for buttons180181---182183## Color Theory Foundations184185### Color Harmony Methods186187**Complementary** - Opposites on color wheel:188- High contrast, energetic, bold189- Example: Blue + Orange, Red + Green190- Use for: Bold, tech, creative personalities191192**Analogous** - Adjacent on color wheel:193- Harmonious, calm, cohesive194- Example: Blue + Purple + Teal195- Use for: Professional, minimal, warm personalities196197**Triadic** - Three evenly spaced:198- Balanced, vibrant, dynamic199- Example: Red + Yellow + Blue200- Use for: Playful, creative personalities201202**Monochromatic** - Single hue, varying lightness:203- Clean, sophisticated, minimal204- Use for: Minimal, professional personalities205206### Color Psychology207208**Quick reference:**209- Blue = Trust, professional210- Green = Growth, health211- Purple = Creativity, luxury212- Red = Energy, urgency213- Orange = Friendly, energetic214- Yellow = Optimism, playfulness215- Neutral = Sophisticated, minimal216217**When choosing colors:**218- Consider brand personality219- Use color harmony methods for cohesive palettes220- Verify contrast ratios meet WCAG AA221222---223224## Theme Documentation Format225226**In planning doc:**227228```markdown229## Theme Specification230231### Selected Theme232- Name: [Theme Name]233- Source: .agents/themes/[filename].theme.json OR "Custom generated"234- Personality: [personality traits]235236### Color Palette237**Primary ([Color Name]):**238- Base: [hex] (buttons, links, actions)239- Hover: [hex]240- Active: [hex]241- Full scale: 50-900 shades242243**Neutral:**244- Lightest: [hex] (backgrounds)245- Medium: [hex] (body text)246- Darkest: [hex] (headings)247- Full scale: 50-900 shades248249**Semantic:**250- Success: [hex] / dark: [hex]251- Error: [hex] / dark: [hex]252- Warning: [hex] / dark: [hex]253- Info: [hex] / dark: [hex]254255### Dark Mode Palette256- Background: [hex] (neutral-950)257- Surface: [hex] (neutral-900)258- Body text: [hex] (neutral-200)259- Heading: [hex] (neutral-50)260- Border: [hex] (neutral-700)261- Primary action: [hex] (primary-400)262263### Contrast Verification264- Body text / background: [ratio]:1 ✓/✗265- White / primary button: [ratio]:1 ✓/✗266- Primary text / white: [ratio]:1 ✓/✗267268### Typography269- Heading: [Font family], [weight], [line-height]270- Body: [Font family], [weight], [line-height]271- Scale: [values]272273### Spacing274- Scale: [values - base-4 or base-8]275276### Visual Style277- Border radius: [small/medium/large]278- Shadows: [subtle/medium/strong]279```280281---282283## Theme Application Guidelines284285**Consistency Rules:**286287**Do:**288- Use only colors from theme palette289- Apply spacing scale consistently290- Follow typography scale291- Use semantic colors for their intended purpose292293**Don't:**294- Mix colors from multiple themes295- Use arbitrary values296- Override theme for one-off styles297- Ignore semantic color meanings298299**Component Theming:**300301**Buttons:**302- Primary: Primary color background303- Secondary: Secondary/neutral background304- Outline: Transparent background, primary border305- Ghost: Transparent, primary text only306307**States:**308- Hover: Slightly darker/more saturated309- Active: Noticeably darker than hover310- Disabled: Muted neutral shades311- Focus: Primary color ring312313---314315## Common Mistakes3163171. **No personality** - Generic theme318 → Fix: Choose personality first3192. **Arbitrary tweaks** - Modifying theme colors slightly320 → Fix: Use theme palette exactly as defined3213. **Semantic color abuse** - Green button for delete322 → Fix: Red (error) for destructive, green (success) for positive3234. **Ignoring color harmony** - Random combinations324 → Fix: Use color harmony methods3255. **Theme mixing** - Using colors from multiple themes326 → Fix: Commit to one theme3276. **Copying examples literally** - Using exact values from docs328 → Fix: Generate unique values matching personality329330---331332## Validation Checklist333334- [ ] Brand personality identified335- [ ] Color harmony method used336- [ ] Primary palette complete (50-900 shades)337- [ ] Neutral palette defined (50-900 shades)338- [ ] Semantic colors defined339- [ ] Typography pairing chosen340- [ ] Type scale defined341- [ ] Spacing scale defined342- [ ] Border radius values chosen343- [ ] Shadow system defined344- [ ] Theme documented in planning doc345- [ ] All colors pass WCAG AA contrast346- [ ] Key contrast pairs verified (text/bg, white/primary, primary/white)347- [ ] Dark mode palette derived (neutral scale inverted, primary shifted)348- [ ] Dark mode semantic colors adjusted (+100-200 steps lighter)349350---351352## Key Takeaway353354**Color harmony + brand personality = cohesive themes.**355356When users need help choosing colors/fonts:3571. Ask brand personality3582. Apply color harmony methods3593. Generate complete theme specification3604. Apply using design-fundamentals principles361362Theme-factory provides **interactive selection** and **color theory methods**.363Design-fundamentals provides **application principles** and **technical foundation**.364365Together: Distinctive, cohesive, accessible UI themes.