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: Theme/color selection when user has no aesthetic direction and wants agent to decide. Use when: user is uncertain — "suggest colors", "what theme", "help me choose", "you pick". Keywords: suggest theme, suggest colors, what theme, what colors, help choose, help pick, no direction, you choose, recommend colors Do NOT use for: user has colors/style in mind, applying existing theme.4---56# Theme Factory78## Purpose9Generate cohesive, beautiful UI themes when no design specifications provided, preventing generic monotone interfaces.1011---1213## Core Principle1415**Brand personality drives design decisions.**1617Every 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.1819**Good theme** = Intentional, cohesive, personality-aligned20**Bad theme** = Random colors, inconsistent, no personality2122---2324## When to Use Theme Factory2526**Use when user EXPLICITLY asks for theme help:**27- "What theme should I use?"28- "Help me pick colors"29- "What colors work well together?"30- User uncertain about aesthetic choices3132**Don't use if:**33- User has clear aesthetic in mind → design-fundamentals handles it34- Figma file/URL provided → use figma-design-extraction35- User already chose colors/fonts → just apply them3637---3839## Theme Selection Process4041### Step 1: Understand Brand Personality4243**Ask user (concise, 1-2 questions max):**4445**Question 1: "What personality should this UI have?"**46- **Professional** - Corporate, trustworthy, business-focused47- **Creative** - Bold, artistic, unique, expressive48- **Minimal** - Clean, sophisticated, simple, timeless49- **Bold/Tech** - Modern, eye-catching, innovative50- **Warm/Organic** - Natural, welcoming, friendly51- **Playful** - Fun, colorful, approachable, energetic5253**Question 2: "Any color preferences or inspirations?"**54- Specific colors they like55- Competitor/inspiration URLs56- Or: "Auto-generate based on personality"5758### Step 2: Present Theme Options5960**Show 2-3 pre-defined themes from `.agents/themes/` matching personality**6162Example:63```641. Professional Blue - Corporate, trustworthy, clean652. Minimal Monochrome - Sophisticated, timeless663. Generate custom theme based on your preferences67```6869**If user wants custom:** Generate based on personality + color preferences7071---7273## Theme Anatomy7475### 1. Colors7677**Primary Palette (shades 50-900):**78- Used for: Main actions, links, buttons, key UI elements79- Scale: 50 (lightest) → 900 (darkest)8081**Neutral Palette (50-900):**82- Used for: Text, backgrounds, borders, subtle UI83- Principle: True grays or slightly tinted toward primary8485**Semantic Colors:**86- Success: Green (growth, positive, confirmation)87- Warning: Yellow/orange (caution, attention)88- Error: Red (danger, mistakes, destructive)89- Info: Blue (information, neutral)9091**Why this structure:**92- Full palette enables light/dark modes93- Semantic colors ensure accessibility94- Neutrals provide visual breathing room9596### Dark Mode Variant9798**Derive dark palette from the same hue — don't invent new colors.**99100| Role | Light mode | Dark mode |101|------|-----------|-----------|102| Page background | neutral-50 | neutral-950 |103| Surface (card/panel) | neutral-100 | neutral-900 |104| Surface hover | neutral-200 | neutral-800 |105| Body text | neutral-700 | neutral-200 |106| Heading text | neutral-900 | neutral-50 |107| Border | neutral-200 | neutral-700 |108| Primary action | primary-600 | primary-400 |109| Primary text on surface | primary-700 | primary-300 |110111**Key rules:**112- Primary hue stays the same — only shift lightness (600→400 for dark)113- Semantic colors (success/error/warning) lighten ~100-200 steps in dark mode114- Never use the same shade for both modes — always invert the scale direction115116---117118### 2. Typography119120**See design-fundamentals for typography pairing principles.**121122Theme should define:123- Font families (heading + body)124- Type scale values125- Font weights available126- Line heights127128### 3. Spacing System129130**See design-fundamentals for spacing scale principles.**131132Theme should define:133- Base unit (4px or 8px)134- Scale values135136### 4. Visual Properties137138**Border Radius:**139- **Minimal**: Small or none (sharp, clean)140- **Friendly**: Medium roundness (approachable, soft)141- **Playful**: Large roundness or full pill shapes (fun, organic)142143**Shadows:**144- Subtle shadows for depth (professional, minimal)145- Stronger shadows for cards/modals (modern, bold)146- No shadows for flat design (minimalist)147- Define elevation system (subtle/medium/strong)148149---150151## Contrast Check152153**WCAG AA minimums (required):**154- Normal text (< 18px): **4.5:1**155- Large text (≥ 18px bold / ≥ 24px): **3:1**156- UI components (buttons, inputs, icons): **3:1**157158**Must-check pairs for every theme:**159160| Pair | Target | Common failure |161|------|--------|---------------|162| Body text on page background | 4.5:1 | Light gray text on white |163| Heading on page background | 4.5:1 | Medium neutral on light neutral |164| White text on primary button | 4.5:1 | Light primaries (yellow, lime) |165| Primary text on white | 4.5:1 | Mid-range primaries (400-500) |166| Placeholder text on input | 3:1 | neutral-400 on white |167168**Quick mental check — the 4.5:1 rule of thumb:**169- Dark text on light bg: text must be ≤ neutral-600 on neutral-50170- Light text on dark bg: text must be ≥ neutral-200 on neutral-900171- Primary-500 on white usually **fails** — use primary-600 or darker for text/icons172173**If primary color is light (yellow, lime, teal-300):**174- Never use as button background with white text → use dark text instead175- Or shift to primary-700 for text, primary-600 for buttons176177---178179## Color Theory Foundations180181### Color Harmony Methods182183**Complementary** - Opposites on color wheel:184- High contrast, energetic, bold185- Example: Blue + Orange, Red + Green186- Use for: Bold, tech, creative personalities187188**Analogous** - Adjacent on color wheel:189- Harmonious, calm, cohesive190- Example: Blue + Purple + Teal191- Use for: Professional, minimal, warm personalities192193**Triadic** - Three evenly spaced:194- Balanced, vibrant, dynamic195- Example: Red + Yellow + Blue196- Use for: Playful, creative personalities197198**Monochromatic** - Single hue, varying lightness:199- Clean, sophisticated, minimal200- Use for: Minimal, professional personalities201202### Color Psychology203204**Quick reference:**205- Blue = Trust, professional206- Green = Growth, health207- Purple = Creativity, luxury208- Red = Energy, urgency209- Orange = Friendly, energetic210- Yellow = Optimism, playfulness211- Neutral = Sophisticated, minimal212213**When choosing colors:**214- Consider brand personality215- Use color harmony methods for cohesive palettes216- Verify contrast ratios meet WCAG AA217218---219220## Theme Documentation Format221222**In planning doc:**223224```markdown225## Theme Specification226227### Selected Theme228- Name: [Theme Name]229- Source: .agents/themes/[filename].theme.json OR "Custom generated"230- Personality: [personality traits]231232### Color Palette233**Primary ([Color Name]):**234- Base: [hex] (buttons, links, actions)235- Hover: [hex]236- Active: [hex]237- Full scale: 50-900 shades238239**Neutral:**240- Lightest: [hex] (backgrounds)241- Medium: [hex] (body text)242- Darkest: [hex] (headings)243- Full scale: 50-900 shades244245**Semantic:**246- Success: [hex] / dark: [hex]247- Error: [hex] / dark: [hex]248- Warning: [hex] / dark: [hex]249- Info: [hex] / dark: [hex]250251### Dark Mode Palette252- Background: [hex] (neutral-950)253- Surface: [hex] (neutral-900)254- Body text: [hex] (neutral-200)255- Heading: [hex] (neutral-50)256- Border: [hex] (neutral-700)257- Primary action: [hex] (primary-400)258259### Contrast Verification260- Body text / background: [ratio]:1 ✓/✗261- White / primary button: [ratio]:1 ✓/✗262- Primary text / white: [ratio]:1 ✓/✗263264### Typography265- Heading: [Font family], [weight], [line-height]266- Body: [Font family], [weight], [line-height]267- Scale: [values]268269### Spacing270- Scale: [values - base-4 or base-8]271272### Visual Style273- Border radius: [small/medium/large]274- Shadows: [subtle/medium/strong]275```276277---278279## Theme Application Guidelines280281**Consistency Rules:**282283**Do:**284- Use only colors from theme palette285- Apply spacing scale consistently286- Follow typography scale287- Use semantic colors for their intended purpose288289**Don't:**290- Mix colors from multiple themes291- Use arbitrary values292- Override theme for one-off styles293- Ignore semantic color meanings294295**Component Theming:**296297**Buttons:**298- Primary: Primary color background299- Secondary: Secondary/neutral background300- Outline: Transparent background, primary border301- Ghost: Transparent, primary text only302303**States:**304- Hover: Slightly darker/more saturated305- Active: Noticeably darker than hover306- Disabled: Muted neutral shades307- Focus: Primary color ring308309---310311## Common Mistakes3123131. **No personality** - Generic theme314 → Fix: Choose personality first3152. **Arbitrary tweaks** - Modifying theme colors slightly316 → Fix: Use theme palette exactly as defined3173. **Semantic color abuse** - Green button for delete318 → Fix: Red (error) for destructive, green (success) for positive3194. **Ignoring color harmony** - Random combinations320 → Fix: Use color harmony methods3215. **Theme mixing** - Using colors from multiple themes322 → Fix: Commit to one theme3236. **Copying examples literally** - Using exact values from docs324 → Fix: Generate unique values matching personality325326---327328## Validation Checklist329330- [ ] Brand personality identified331- [ ] Color harmony method used332- [ ] Primary palette complete (50-900 shades)333- [ ] Neutral palette defined (50-900 shades)334- [ ] Semantic colors defined335- [ ] Typography pairing chosen336- [ ] Type scale defined337- [ ] Spacing scale defined338- [ ] Border radius values chosen339- [ ] Shadow system defined340- [ ] Theme documented in planning doc341- [ ] All colors pass WCAG AA contrast342- [ ] Key contrast pairs verified (text/bg, white/primary, primary/white)343- [ ] Dark mode palette derived (neutral scale inverted, primary shifted)344- [ ] Dark mode semantic colors adjusted (+100-200 steps lighter)345346---347348## Key Takeaway349350**Color harmony + brand personality = cohesive themes.**351352When users need help choosing colors/fonts:3531. Ask brand personality3542. Apply color harmony methods3553. Generate complete theme specification3564. Apply using design-fundamentals principles357358Theme-factory provides **interactive selection** and **color theory methods**.359Design-fundamentals provides **application principles** and **technical foundation**.360361Together: Distinctive, cohesive, accessible UI themes.