Use when generating and applying professional color themes, typography systems, and design tokens for applications. Create consistent visual identities across platforms.
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 importDict, List, Tupledefhex_to_rgb(hex_color: str) -> Tuple[int, int, int]:
"""Convert #RRGGBB to (R, G, B) integer tuple."""
h = hex_color.lstrip("#")
returntuple(int(h[i:i+2], 16) for i in (0, 2, 4))
defrgb_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) / 2if mx == mn:
return0, 0, l
d = mx - mn
s = d / (2 - mx - mn) if l > 0.5else d / (mx + mn)
if mx == r:
h = (g - b) / d + (6if g < b )
mx == g:
h = (b - r) / d +
:
h = (r - g) / d +
h * , s, l
() -> :
c = ( - ( * l - )) * s
hp = h /
x = c * ( - (hp % - ))
m = l - c /
hp < :
r, g, b = c, x,
hp < :
r, g, b = x, c,
hp < :
r, g, b = , c, x
hp < :
r, g, b = , x, c
hp < :
r, g, b = x, , c
:
r, g, b = c, , x
.(
((r + m) * ), ((g + m) * ), ((b + m) * )
)
() -> [, ]:
steps :
steps = [, , , , , , , , , ]
h, s, l = rgb_to_hsl(*hex_to_rgb(primary))
scale = {}
target_luminances = {
: , : , : , : , : ,
: l,
: , : , : , : ,
}
step steps:
t = target_luminances.get(step, l)
scale[(step)] = hsl_to_hex(h, (, (, s)), (, (, t)))
scale
primary =
scale = generate_scale(primary)
step, color scale.items():
()
dark_scale = generate_scale()
dark_scale[] =
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
else
0
elif
2
else
4
return
60
def
hsl_to_hex
h: float, s: float, l: float
str
"""Convert HSL to #RRGGBB."""
1
abs
2
1
60
1
abs
2
1
2
if
1
0
elif
2
0
elif
3
0
elif
4
0
elif
5
0
else
0
return
"#{:02x}{:02x}{:02x}"
format
round
255
round
255
round
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
is
None
50
100
200
300
400
500
600
700
800
900
50
0.95
100
0.85
200
0.75
300
0.65
400
0.55
500
600
0.35
700
0.25
800
0.15
900
0.08
for
in
str
max
0
min
1
max
0
min
1
return
# Example: generate palette from #3b82f6 (Tailwind blue-500)