Theme Factory
Generate comprehensive, accessible, and scalable design themes using a tokens-first approach.
The Tokens-First Approach
Themes should be defined using Design Tokens (CSS variables) rather than hardcoded values. This ensures consistency and enables instant theme switching (e.g., light to dark).
1. Primitive Tokens (The RAW values)
The base colors, spacing, and typography without semantic meaning.
:root {
--blue-500: #3b82f6;
--gray-900: #111827;
--spacing-4: 1rem;
}
2. Semantic Tokens (The PURPOSE)
Values mapped to a specific role in the UI.
[data-theme="light"] {
--bg-primary: #ffffff;
--text-main: var(--gray-900);
--accent: var(--blue-500);
}
[data-theme="dark"] {
--bg-primary: var(--gray-900);
--text-main: #f9fafb;
--accent: var(--blue-400);
}
Theme Components
1. Color Palette Expansion
For any primary brand color, generate a functional scale (50–900).
- 50–200: Light backgrounds, subtle borders.
- 400–600: Primary actions, main brand presence.
- 700–900: Dark text, deep contrast elements.
2. Elevating Surfaces (Z-Index and Shadows)
Define how elements "lift" off the background.
- Level 0: Background / Base.
- Level 1: Cards, sections.
- Level 2: Modals, popovers, tooltips.
3. Typography & Spacing
- Scale should be modular (e.g., 1.25 ratio).
- Spacing should be based on a fixed unit (e.g., 4px or 8px grid).
Design Systems Supported
- Vanilla CSS: CSS Custom Properties (
--variable).
- Tailwind CSS:
tailwind.config.js extensions.
- Styled Components: Theme provider objects.
- Figma Variables: Structured JSON export.
Interaction Workflow
Step 1: Definition
Identify the base "brand vibe" or existing brand color.
- Is it high-energy (vibrant), professional (muted), minimal, or experimental?
- Identify the core primary color.
Step 2: Generation
Generate the token set:
- Core palette (Functional scales for Primary, Secondary, Grey, Semantic).
- Surface system (Backgrounds, Borders, Cards).
- Interactive states (Hover, Active, Focus, Disabled).
- Dark Mode variant (Ensuring WCAG contrast compliance).
Step 3: Implementation Guide
Provide the CSS or configuration file and show how to apply it:
<button class="bg-[var(--accent)] text-[var(--text-on-accent)]">
Click Me
</button>
Best Practices
- Accessibility First: Always verify contrast of
text-on-background for every level of the theme.
- Naming Consistency: Use consistent naming like
bg-base, bg-subtle, text-muted, text-strong.
- Avoid Over-Theming: Don't create tokens for every single property; focus on the core system that covers 90% of use cases.
1---2name: theme-factory3description: Creates design themes and token systems for applications, websites, and UI components. Use when the user requests a new visual theme, dark/light mode variants, color scheme expansion, or design token definitions. Do NOT use for general branding or individual component styling.4license: MIT5---6# Theme Factory78Generate comprehensive, accessible, and scalable design themes using a tokens-first approach.910---1112## The Tokens-First Approach1314Themes should be defined using **Design Tokens** (CSS variables) rather than hardcoded values. This ensures consistency and enables instant theme switching (e.g., light to dark).1516### 1. Primitive Tokens (The RAW values)17The base colors, spacing, and typography without semantic meaning.18```css19:root {20 --blue-500: #3b82f6;21 --gray-900: #111827;22 --spacing-4: 1rem;23}24```2526### 2. Semantic Tokens (The PURPOSE)27Values mapped to a specific role in the UI.28```css29[data-theme="light"] {30 --bg-primary: #ffffff;31 --text-main: var(--gray-900);32 --accent: var(--blue-500);33}3435[data-theme="dark"] {36 --bg-primary: var(--gray-900);37 --text-main: #f9fafb;38 --accent: var(--blue-400);39}40```4142---4344## Theme Components4546### 1. Color Palette Expansion47For any primary brand color, generate a functional scale (50–900).48- **50–200**: Light backgrounds, subtle borders.49- **400–600**: Primary actions, main brand presence.50- **700–900**: Dark text, deep contrast elements.5152### 2. Elevating Surfaces (Z-Index and Shadows)53Define how elements "lift" off the background.54- **Level 0**: Background / Base.55- **Level 1**: Cards, sections.56- **Level 2**: Modals, popovers, tooltips.5758### 3. Typography & Spacing59- Scale should be modular (e.g., 1.25 ratio).60- Spacing should be based on a fixed unit (e.g., 4px or 8px grid).6162---6364## Design Systems Supported6566- **Vanilla CSS**: CSS Custom Properties (`--variable`).67- **Tailwind CSS**: `tailwind.config.js` extensions.68- **Styled Components**: Theme provider objects.69- **Figma Variables**: Structured JSON export.7071---7273## Interaction Workflow7475### Step 1: Definition76Identify the base "brand vibe" or existing brand color.77- Is it high-energy (vibrant), professional (muted), minimal, or experimental?78- Identify the core primary color.7980### Step 2: Generation81Generate the token set:82- **Core palette** (Functional scales for Primary, Secondary, Grey, Semantic).83- **Surface system** (Backgrounds, Borders, Cards).84- **Interactive states** (Hover, Active, Focus, Disabled).85- **Dark Mode** variant (Ensuring WCAG contrast compliance).8687### Step 3: Implementation Guide88Provide the CSS or configuration file and show how to apply it:89```html90<button class="bg-[var(--accent)] text-[var(--text-on-accent)]">91 Click Me92</button>93```9495---9697## Best Practices9899- **Accessibility First**: Always verify contrast of `text-on-background` for every level of the theme.100- **Naming Consistency**: Use consistent naming like `bg-base`, `bg-subtle`, `text-muted`, `text-strong`.101- **Avoid Over-Theming**: Don't create tokens for every single property; focus on the core system that covers 90% of use cases.