design-derived-themes

Derive every color token from three inputs: accent, background, contrast

Automatic · foundational · raw .md · GitHub

Install

npx skills add marckohlbrugge/skills --skill design-derived-themes

Or tell your agent:

Install the skill at https://marc.md/design-derived-themes.md

Or by hand, for Claude Code:

mkdir -p ~/.claude/skills/design-derived-themes && curl -fsSL https://marc.md/design-derived-themes.md -o ~/.claude/skills/design-derived-themes/SKILL.md

Derived themes

When: upfront, when colors and theming are first set up; converting a pile of hand-picked tokens later is a big job. Fine shade tuning can wait.

Before their redesign, every Linear theme needed 98 variables defined by hand. Now a theme is three inputs: accent, background, contrast. A system derives the ~90 tokens from those. Simple enough to maintain, powerful enough to feel personal, constrained enough that users can't make it look horrible. Related: design-color-on-color (shading on known backgrounds).

How

:root {
  --base-bg: oklch(0.99 0.005 260);
  --accent: oklch(0.6 0.18 270);
  --contrast: 1; /* 0.7 low … 1.4 high */
  --dir: 1;      /* -1 when background is dark */

  --bg-raised: oklch(from var(--base-bg) calc(l - 0.02 * var(--dir)) c h);
  --border:    oklch(from var(--base-bg) calc(l - 0.08 * var(--dir) * var(--contrast)) c h);
  --text-2:    oklch(from var(--base-bg) calc(l - 0.45 * var(--dir) * var(--contrast)) calc(c * 2) h);
  --text-1:    oklch(from var(--base-bg) calc(l - 0.8 * var(--dir) * var(--contrast)) c h);
  --accent-hover: oklch(from var(--accent) calc(l + 0.05 * var(--dir)) c h);
}

Check