Design Systems11 min read2026-07-18

Automating Design Systems: Colors, Typography Scales & Component Tokens

A complete technical guide to generating, exporting, and managing WCAG-compliant color palettes, fluid typography math, and reusable CSS variables.

Sophia ChenDesign Tokens & Design System Engineer
Automating Design Systems: Colors, Typography Scales & Component Tokens

A design system is the single source of truth for UI consistency. Automating design tokens ensures that every button, card, header, and input field automatically respects brand scales, color contrast rules, and responsive mathematical ratios.

1. Fluid Typography Math & Modular Scales

Instead of hardcoding font sizes for every breakpoint, modern design systems compute fluid font sizes using the CSS clamp() function based on a Major Third (1.25) scale ratio:

/* Fluid Typography Design Tokens */
:root {
  --font-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --font-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --font-base: clamp(1rem, 0.95rem + 0.4vw, 1.125rem);
  --font-lg: clamp(1.125rem, 1rem + 0.6vw, 1.33rem);
  --font-xl: clamp(1.33rem, 1.1rem + 1.1vw, 1.77rem);
  --font-2xl: clamp(1.77rem, 1.3rem + 2.1vw, 2.36rem);
  --font-hero: clamp(2.5rem, 1.8rem + 3.5vw, 4.5rem);
}
      

2. WCAG-Compliant HSL Color Architecture

Generative AI constructs color palettes using HSL (Hue, Saturation, Lightness) tokens to maintain 4.5:1 minimum contrast ratios for readable body text and 3:1 for graphical UI elements:

/* HSL Token Architecture */
:root {
  /* Brand Primary: H=210, S=100% */
  --primary-h: 210;
  --primary-s: 100%;
  --primary-500: hsl(var(--primary-h), var(--primary-s), 50%);
  --primary-600: hsl(var(--primary-h), var(--primary-s), 40%);
  --primary-100: hsl(var(--primary-h), var(--primary-s), 95%);

  /* Surface & Borders */
  --bg-canvas: #0a0e17;
  --surface-card: rgba(18, 26, 42, 0.7);
  --border-glass: rgba(255, 255, 255, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}
      

3. Complete Copy-Pasteable Component Tokens

Below is the production component token configuration for buttons, cards, and input controls exported directly from Design Maker AI:

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 4px 14px 0 rgba(14, 165, 233, 0.39);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(14, 165, 233, 0.55);
}

.card-glass {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 1.75rem;
}
      
Try Design Maker AI

Ready to generate your next web design in seconds?

Turn your prompts into high-fidelity UI mockups, landing pages, and marketing graphics with AI.