Use when generating and applying professional color themes, typography systems, and design tokens for applications. Create consistent visual identities across platforms.
"Generate and apply professional color themes, typography systems, and design tok"
When creating a new visual theme or color palette
When defining design tokens for a design system
When rebranding an application
When ensuring visual consistency across platforms
When NOT to Use
For implementing existing designs (use frontend-ui-design)
For logo design (use image generation skills)
For content creation (use content skills)
Overview
Generate professional design systems including color palettes, typography scales, spacing systems, and design tokens. Supports CSS custom properties, Tailwind config, and design token JSON.
Generate a full color scale from a single hex primary using HSL interpolation for light→dark variants (simplified HSL demo — for OKLCH-based perceptual uniformity use the colour or culori libraries listed below):
from typing import Dict, List, Tuple
def hex_to_rgb(hex_color: str) -> Tuple[int, int, int]:
"""Convert #RRGGBB to (R, G, B) integer tuple."""
h = hex_color.lstrip("#")
return tuple(int(h[i:i+2], 16) for i in (0, 2, 4))
def rgb_to_hsl(r: int, g: int, b: int) -> Tuple[float, float, float]:
"""Convert RGB 0-255 to HSL 0-360 / 0-1 / 0-1."""
r, g, b = r / 255, g / 255, b / 255
mx, mn = max(r, g, b), min(r, g, b)
l = (mx + mn) / 2
if mx == mn:
return 0, 0, l
d = mx - mn
s = d / (2 - mx - mn) if l > 0.5 else d / (mx + mn)
if mx == r:
h = (g - b) / d + (6 if g < b else 0)
elif mx == g:
h = (b - r) / d + 2
else:
h = (r - g) / d + 4
return h * 60, s, l
def hsl_to_hex(h: float, s: float, l: float) -> str:
"""Convert HSL to #RRGGBB."""
c = (1 - abs(2 * l - 1)) * s
hp = h / 60
x = c * (1 - abs(hp % 2 - 1))
m = l - c / 2
if hp < 1:
r, g, b = c, x, 0
elif hp < 2:
r, g, b = x, c, 0
elif hp < 3:
r, g, b = 0, c, x
elif hp < 4:
r, g, b = 0, x, c
elif hp < 5:
r, g, b = x, 0, c
else:
r, g, b = c, 0, x
return "#{:02x}{:02x}{:02x}".format(
round((r + m) * 255), round((g + m) * 255), round((b + m) * 255)
)
def generate_scale(primary: str, steps: List[int] = None) -> Dict[str, str]:
"""Generate a 50-900 color scale from one primary hex.
Light shades (50-400) blend toward white; dark shades (600-900)
blend toward black; 500 is the reference.
"""
if steps is None:
steps = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900]
h, s, l = rgb_to_hsl(*hex_to_rgb(primary))
scale = {}
target_luminances = {
50: 0.95, 100: 0.85, 200: 0.75, 300: 0.65, 400: 0.55,
500: l,
600: 0.35, 700: 0.25, 800: 0.15, 900: 0.08,
}
for step in steps:
t = target_luminances.get(step, l)
scale[str(step)] = hsl_to_hex(h, max(0, min(1, s)), max(0, min(1, t)))
return scale
# Example: generate palette from #3b82f6 (Tailwind blue-500)
primary = "#3b82f6"
scale = generate_scale(primary)
for step, color in scale.items():
print(f" --color-primary-{step}: {color};")
# Dark-mode invert: shift lightness toward black, reduce saturation
dark_scale = generate_scale("#60a5fa")
dark_scale["50"] = "#1e3a8a" # override for deeper dark background
Production-ready palette libraries:
[palette] — Extract color palettes from images (k-means clustering)
[colour] — Advanced color science (perceptual deltas, gamut mapping)
pip install colour-science # advanced color science
pip install palettable # predefined color palettes
pip install wcag-contrast-ratio # accessibility ratio checks
pip install Pillow # image-based palette extraction
Node.js environment:
npm install chroma-js # color manipulation (OKLCH, HSL, contrast)
npm install color # CSS color string parsing
npm install culori # color conversion + interpolation
npm install @radix-ui/colors # radix color scales reference
Figma token sync (optional):
npm install style-dictionary # Amazon Style Dictionary — compile design tokens
npx token-transformer # convert Figma Tokens to Style-Dictionary format
For production theme pipelines, use Style Dictionary to compile tokens into platform-specific outputs (CSS, iOS, Android, React Native) from a single JSON source.
Common Issues & Troubleshooting
Problem
Solution
Color scale looks muddy / low saturation
Reduce the saturation multiplier for mid-range steps (200-400). Perceptual spacing via OKLCH color space produces cleaner ramps. Try culori with lch() interpolation
WCAG AA contrast fails on primary-500 buttons
Shift the button color toward the darker end of the scale (use primary-600 or primary-700 for text on white backgrounds). Check ratio with wcag-contrast-ratio library
Dark-mode tokens produce washed-out colors
Dark mode needs lower saturation, not just inverted lightness. Reduce saturation by 15-30% for mid-tones and boost the lighter end (50-200) to ensure contrast on dark backgrounds
Typography scale looks uneven
Minor second (1.067) for dense UIs, major third (1.25) for editorial. Scale base size from 16px and verify each step: h1 = base * ratio^3, h2 = base * ratio^2, h3 = base * ratio
Generated palette has too many/too few shades
Target 10-step (50-900) for brands, 6-step (100-700) for neutral grays. Merge extremes (50+100, 800+900) when the palette feels redundant
Spacing tokens feel arbitrary
Use a modular scale: space(n) = base * n where base = 4px (tight) or 8px (generous). Every distance should be a multiple of the base unit
Figma tokens won't import
Convert to W3C Design Tokens format using style-dictionary or token-transformer. Some tools expect $value / $type keys instead of plain values
Monetization
Theme Marketplace
Create and sell premium themes as digital products:
Tailwind UI kits — Full application themes with color palettes, typography, components ($49-149/sale). List on Tailwind UI, ThemeForest, or Gumroad
Figma Design System — Complete token-based design systems with light/dark mode, component library, and documentation ($79-199/sale)
Brand-in-a-box — Generate brand identity packages (logo + palette + typography + tokens) and sell on a micro-site. Target startups that need instant branding ($199-499/package)
Subscription palette feed — Weekly or monthly curated color palettes with code exports (CSS/JSON/Tailwind) on a membership platform ($9-29/month)
Design System Service
Offer custom design system consulting as a service:
Design system audit — Review existing UI for inconsistencies, document token gaps, produce a migration plan ($500-2,000/engagement)
Custom theme generation — Build a complete production theme from brand guidelines: colors, typography, spacing, components, dark mode ($1,000-5,000)
Token integration — Wire the theme into their codebase (CSS custom properties, Tailwind, styled-components) with CI/CD token publishing ($2,000-8,000)
Multi-brand white-label — Architecture for SaaS platforms needing per-tenant themes (brand colors, logo, fonts) with runtime token switching ($5,000-15,000)
Automated Add-ons
WCAG accessibility scanner for themes — SaaS that crawls any CSS file and reports contrast failures ($49/month)
Theme snapshot service — Generate before/after screenshots of an app with different themes for client pitches (per-project)
Token diff pipeline — CI plugin that fails builds when design tokens change unexpectedly, with approval workflow (open-source with paid enterprise tier)
Process
Define primitives — Lock in the brand primary hex. Choose neutral undertone (warm/cool/true gray). Pick font superfamily (e.g. Inter for UI + Merriweather for headings). Set the base space unit (4px or 8px).
Map semantic roles — Assign token names to functional roles: --color-bg, --color-text, --color-border, --color-accent. Decide which roles are theme-aware (swap in dark mode) and which are invariant.
Generate palette scale — Run the Python or JS palette generator from the primary, producing 10-step (50-900) scales for each role color. Verify each step with wcag-contrast-ratio against expected backgrounds.
Create variant recipes — Define interaction states: hover → adjust lightness by ±8%, active → ±12%, disabled → opacity 0.38 + desaturate. Store as functions in design tokens, not hardcoded values.
Export targets — Compile tokens to CSS custom properties for web, JSON for style-dictionary, Tailwind config for utility-first, and Figma tokens for designers. Dark mode is a separate export pass with inverted values.
Version & publish — Token breaking changes must be communicated via semver. Publish to npm as @company/design-tokens or to a design token CDN endpoint for runtime fetching.
Verification
Every semantic role has a token assignment (bg, text, border, accent, success, error, warning, info)
WCAG AA contrast ratio ≥4.5:1 for body text, ≥3:1 for large text (18px+ bold or 24px+ regular) on all role-appropriate backgrounds
Dark-mode tokens verified: minimum contrast ratio maintained, not just inverted (saturation may need adjustment)
Spacing scale is a strict multiple of the base unit — no orphan distances
Token export produces files for every target (CSS, JSON, Tailwind, Figma) that parse without errors
Dark mode toggles cleanly (swap data-theme attribute) with no un-themed flash
Token changes are versioned: bump MAJOR on breaking role renames, MINOR on new roles, PATCH on color value tweaks
1---2name: theme-factory3description: Use when generating and applying professional color themes, typography4 systems, and design tokens for applications. Create consistent visual identities5 across platforms.6domain: content7author: oyi778license: Apache-2.09subdomain: content-creation10tags:11- design12- themes13- colors14- typography15- design-tokens16- branding17version: 1.0.018category: content19metadata:20 source: https://skillmd.com/skills/oyi77/theme-factory21---222324# Theme Factory2526## When to Use27**Trigger phrases:**28- "theme factory"29- "Generate and apply professional color themes, typography systems, and design tok"303132- When creating a new visual theme or color palette33- When defining design tokens for a design system34- When rebranding an application35- When ensuring visual consistency across platforms3637## When NOT to Use3839- For implementing existing designs (use `frontend-ui-design`)40- For logo design (use image generation skills)41- For content creation (use content skills)4243## Overview4445Generate professional design systems including color palettes, typography scales, spacing systems, and design tokens. Supports CSS custom properties, Tailwind config, and design token JSON.4647## Workflow48491. **Define brand** — Primary color, mood, audience502. **Generate palette** — Primary, secondary, accent, neutral, semantic colors513. **Define typography** — Font stack, scale, line heights, weights524. **Create tokens** — Design token JSON for cross-platform use535. **Export** — CSS variables, Tailwind config, Figma tokens5455## Anti-Rationalization Table5657| Rationalization | Reality |58|---|---|59| "I will pick colors by eye" | Systematic color theory ensures accessibility and harmony |60| "One font is enough" | A type scale (headings, body, caption) creates visual hierarchy |61| "Hardcode colors in components" | Design tokens enable theme switching and dark mode |6263## Code Example (CSS Custom Properties)6465```css66:root {67 --color-primary-50: #eff6ff;68 --color-primary-500: #3b82f6;69 --color-primary-900: #1e3a8a;70 --font-family-sans: 'Inter', system-ui, sans-serif;71 --font-size-xs: 0.75rem;72 --font-size-base: 1rem;73 --font-size-2xl: 1.5rem;74 --space-1: 0.25rem;75 --space-4: 1rem;76 --space-8: 2rem;7778 [data-theme="dark"] {79 --color-primary-500: #60a5fa;80 --color-bg: #0f172a;81 --color-text: #f8fafc;82 }83}84```8586## Code Example (Python) — Color Palette Generation8788Generate a full color scale from a single hex primary using HSL interpolation for light→dark variants (simplified HSL demo — for OKLCH-based perceptual uniformity use the `colour` or `culori` libraries listed below):8990```python91from typing import Dict, List, Tuple929394def hex_to_rgb(hex_color: str) -> Tuple[int, int, int]:95 """Convert #RRGGBB to (R, G, B) integer tuple."""96 h = hex_color.lstrip("#")97 return tuple(int(h[i:i+2], 16) for i in (0, 2, 4))9899100def rgb_to_hsl(r: int, g: int, b: int) -> Tuple[float, float, float]:101 """Convert RGB 0-255 to HSL 0-360 / 0-1 / 0-1."""102 r, g, b = r / 255, g / 255, b / 255103 mx, mn = max(r, g, b), min(r, g, b)104 l = (mx + mn) / 2105 if mx == mn:106 return 0, 0, l107 d = mx - mn108 s = d / (2 - mx - mn) if l > 0.5 else d / (mx + mn)109 if mx == r:110 h = (g - b) / d + (6 if g < b else 0)111 elif mx == g:112 h = (b - r) / d + 2113 else:114 h = (r - g) / d + 4115 return h * 60, s, l116117118def hsl_to_hex(h: float, s: float, l: float) -> str:119 """Convert HSL to #RRGGBB."""120 c = (1 - abs(2 * l - 1)) * s121 hp = h / 60122 x = c * (1 - abs(hp % 2 - 1))123 m = l - c / 2124 if hp < 1:125 r, g, b = c, x, 0126 elif hp < 2:127 r, g, b = x, c, 0128 elif hp < 3:129 r, g, b = 0, c, x130 elif hp < 4:131 r, g, b = 0, x, c132 elif hp < 5:133 r, g, b = x, 0, c134 else:135 r, g, b = c, 0, x136 return "#{:02x}{:02x}{:02x}".format(137 round((r + m) * 255), round((g + m) * 255), round((b + m) * 255)138 )139140141def generate_scale(primary: str, steps: List[int] = None) -> Dict[str, str]:142 """Generate a 50-900 color scale from one primary hex.143144 Light shades (50-400) blend toward white; dark shades (600-900)145 blend toward black; 500 is the reference.146 """147 if steps is None:148 steps = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900]149 h, s, l = rgb_to_hsl(*hex_to_rgb(primary))150 scale = {}151 target_luminances = {152 50: 0.95, 100: 0.85, 200: 0.75, 300: 0.65, 400: 0.55,153 500: l,154 600: 0.35, 700: 0.25, 800: 0.15, 900: 0.08,155 }156 for step in steps:157 t = target_luminances.get(step, l)158 scale[str(step)] = hsl_to_hex(h, max(0, min(1, s)), max(0, min(1, t)))159 return scale160161162# Example: generate palette from #3b82f6 (Tailwind blue-500)163primary = "#3b82f6"164scale = generate_scale(primary)165for step, color in scale.items():166 print(f" --color-primary-{step}: {color};")167168# Dark-mode invert: shift lightness toward black, reduce saturation169dark_scale = generate_scale("#60a5fa")170dark_scale["50"] = "#1e3a8a" # override for deeper dark background171```172173**Production-ready palette libraries:**174175- [palette] — Extract color palettes from images (k-means clustering)176- [colour] — Advanced color science (perceptual deltas, gamut mapping)177- [wcag-contrast-ratio] — Check accessibility ratios programmatically178179## Code Example (JavaScript) — Design Token → CSS Variables180181Generate theme CSS and Tailwind config from a design-token JSON object, including dark-mode inversion and TypeScript types:182183```javascript184/**185 * Generate CSS custom properties string from a token tree.186 * Flattens nested keys into `--category-key-subkey` variable names.187 */188function tokensToCSS(tokens, { prefix = "", theme = "light" } = {}) {189 const lines = [];190 for (const [key, value] of Object.entries(tokens)) {191 const varName = prefix ? `${prefix}-${key}` : key;192 if (typeof value === "object" && value !== null && !Array.isArray(value)) {193 lines.push(tokensToCSS(value, { prefix: varName, theme }));194 } else {195 lines.push(` --${varName}: ${value};`);196 }197 }198 return lines.join("\n");199}200201/**202 * Invert a light palette for dark mode by swapping light/dark steps.203 * dark[50] -> light[900], dark[100] -> light[800], etc.204 */205function invertPalette(tokens) {206 const inverted = JSON.parse(JSON.stringify(tokens));207 for (const [cat, scale] of Object.entries(tokens)) {208 if (typeof scale !== "object") continue;209 inverted[cat] = {};210 for (const [step, color] of Object.entries(scale)) {211 const num = parseInt(step, 10);212 const invertedStep = isNaN(num) ? step : String(1000 - num);213 inverted[cat][invertedStep] = color;214 }215 }216 return inverted;217}218219// ---- Example ----220const tokens = {221 color: {222 primary: { 50: "#eff6ff", 500: "#3b82f6", 900: "#1e3a8a" },223 neutral: { 50: "#fafafa", 500: "#737373", 900: "#171717" },224 },225 font: {226 family: { sans: "'Inter', system-ui, sans-serif" },227 size: { xs: "0.75rem", base: "1rem", xl: "1.5rem" },228 },229 space: { 1: "0.25rem", 4: "1rem", 8: "2rem" },230};231232const lightCSS = `:root {\n${tokensToCSS(tokens)}\n}`;233console.log(lightCSS);234235const darkTokens = invertPalette(tokens);236const darkCSS = `[data-theme="dark"] {\n${tokensToCSS(darkTokens)}\n}`;237console.log(darkCSS);238239// ---- Tailwind v3/v4 config export ----240function tokensToTailwind(tokens) {241 const tw = { theme: { extend: {} } };242 for (const [cat, values] of Object.entries(tokens)) {243 if (cat === "font" && values.family) {244 tw.theme.extend.fontFamily = { sans: values.family.sans.split(",").map(s => s.trim()) };245 }246 if (cat === "space") {247 tw.theme.extend.spacing = Object.fromEntries(248 Object.entries(values).map(([k, v]) => [k, v])249 );250 }251 }252 return tw;253}254// Usage: write tailwind.config.js with module.exports = tokensToTailwind(tokens)255```256257## Setup & Configuration258259**Python environment:**260```bash261pip install colour-science # advanced color science262pip install palettable # predefined color palettes263pip install wcag-contrast-ratio # accessibility ratio checks264pip install Pillow # image-based palette extraction265```266267**Node.js environment:**268```bash269npm install chroma-js # color manipulation (OKLCH, HSL, contrast)270npm install color # CSS color string parsing271npm install culori # color conversion + interpolation272npm install @radix-ui/colors # radix color scales reference273```274275**Figma token sync (optional):**276```bash277npm install style-dictionary # Amazon Style Dictionary — compile design tokens278npx token-transformer # convert Figma Tokens to Style-Dictionary format279```280281For production theme pipelines, use [Style Dictionary](https://amzn.github.io/style-dictionary/) to compile tokens into platform-specific outputs (CSS, iOS, Android, React Native) from a single JSON source.282283## Common Issues & Troubleshooting284285| Problem | Solution |286|---|---|287| Color scale looks muddy / low saturation | Reduce the saturation multiplier for mid-range steps (200-400). Perceptual spacing via OKLCH color space produces cleaner ramps. Try `culori` with `lch()` interpolation |288| WCAG AA contrast fails on primary-500 buttons | Shift the button color toward the darker end of the scale (use primary-600 or primary-700 for text on white backgrounds). Check ratio with `wcag-contrast-ratio` library |289| Dark-mode tokens produce washed-out colors | Dark mode needs lower saturation, not just inverted lightness. Reduce saturation by 15-30% for mid-tones and boost the lighter end (50-200) to ensure contrast on dark backgrounds |290| Typography scale looks uneven | Minor second (1.067) for dense UIs, major third (1.25) for editorial. Scale base size from 16px and verify each step: `h1 = base * ratio^3`, `h2 = base * ratio^2`, `h3 = base * ratio` |291| Generated palette has too many/too few shades | Target 10-step (50-900) for brands, 6-step (100-700) for neutral grays. Merge extremes (50+100, 800+900) when the palette feels redundant |292| Spacing tokens feel arbitrary | Use a modular scale: `space(n) = base * n` where `base = 4px` (tight) or `8px` (generous). Every distance should be a multiple of the base unit |293| Figma tokens won't import | Convert to W3C Design Tokens format using `style-dictionary` or `token-transformer`. Some tools expect `$value` / `$type` keys instead of plain values |294295## Monetization296297### Theme Marketplace298Create and sell premium themes as digital products:299300- **Tailwind UI kits** — Full application themes with color palettes, typography, components ($49-149/sale). List on Tailwind UI, ThemeForest, or Gumroad301- **Figma Design System** — Complete token-based design systems with light/dark mode, component library, and documentation ($79-199/sale)302- **Brand-in-a-box** — Generate brand identity packages (logo + palette + typography + tokens) and sell on a micro-site. Target startups that need instant branding ($199-499/package)303- **Subscription palette feed** — Weekly or monthly curated color palettes with code exports (CSS/JSON/Tailwind) on a membership platform ($9-29/month)304305### Design System Service306Offer custom design system consulting as a service:307308- **Design system audit** — Review existing UI for inconsistencies, document token gaps, produce a migration plan ($500-2,000/engagement)309- **Custom theme generation** — Build a complete production theme from brand guidelines: colors, typography, spacing, components, dark mode ($1,000-5,000)310- **Token integration** — Wire the theme into their codebase (CSS custom properties, Tailwind, styled-components) with CI/CD token publishing ($2,000-8,000)311- **Multi-brand white-label** — Architecture for SaaS platforms needing per-tenant themes (brand colors, logo, fonts) with runtime token switching ($5,000-15,000)312313### Automated Add-ons314- **WCAG accessibility scanner for themes** — SaaS that crawls any CSS file and reports contrast failures ($49/month)315- **Theme snapshot service** — Generate before/after screenshots of an app with different themes for client pitches (per-project)316- **Token diff pipeline** — CI plugin that fails builds when design tokens change unexpectedly, with approval workflow (open-source with paid enterprise tier)317318## Process3193201. **Define primitives** — Lock in the brand primary hex. Choose neutral undertone (warm/cool/true gray). Pick font superfamily (e.g. Inter for UI + Merriweather for headings). Set the base space unit (4px or 8px).3212. **Map semantic roles** — Assign token names to functional roles: `--color-bg`, `--color-text`, `--color-border`, `--color-accent`. Decide which roles are theme-aware (swap in dark mode) and which are invariant.3223. **Generate palette scale** — Run the Python or JS palette generator from the primary, producing 10-step (50-900) scales for each role color. Verify each step with `wcag-contrast-ratio` against expected backgrounds.3234. **Create variant recipes** — Define interaction states: `hover` → adjust lightness by ±8%, `active` → ±12%, `disabled` → opacity 0.38 + desaturate. Store as functions in design tokens, not hardcoded values.3245. **Export targets** — Compile tokens to CSS custom properties for web, JSON for style-dictionary, Tailwind config for utility-first, and Figma tokens for designers. Dark mode is a separate export pass with inverted values.3256. **Version & publish** — Token breaking changes must be communicated via semver. Publish to npm as `@company/design-tokens` or to a design token CDN endpoint for runtime fetching.326327## Verification328329- [ ] Every semantic role has a token assignment (bg, text, border, accent, success, error, warning, info)330- [ ] WCAG AA contrast ratio ≥4.5:1 for body text, ≥3:1 for large text (18px+ bold or 24px+ regular) on all role-appropriate backgrounds331- [ ] Dark-mode tokens verified: minimum contrast ratio maintained, not just inverted (saturation may need adjustment)332- [ ] Typography scale covers at least: display, h1, h2, h3, body, caption, overline, code333- [ ] Spacing scale is a strict multiple of the base unit — no orphan distances334- [ ] Token export produces files for every target (CSS, JSON, Tailwind, Figma) that parse without errors335- [ ] Dark mode toggles cleanly (swap `data-theme` attribute) with no un-themed flash336- [ ] Token changes are versioned: bump MAJOR on breaking role renames, MINOR on new roles, PATCH on color value tweaks
Run npx get-skill add oyi77/theme-factory in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Use when generating and applying professional color themes, typography systems, and design tokens for applications. Create consistent visual identities across platforms. It is listed under Design & Media on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. Capability flags: makes network calls, reads secrets. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free. This skill is licensed under Apache-2.
oyi77 (@oyi77) published this skill. Their other Agent Skills are listed on their SkillMD profile.