Awesome Color and Typography for UI: Color Theory, Palettes, Type Scales and Font Pairing (2027)
A practical, curated guide to color theory and typography for UI design: palette generators, accessible contrast, OKLCH, dark mode, type scales, fluid typography, font pairing, variable fonts and the best tools, guides and books.
Last reviewed: December 2026
Color and typography decide most of how an interface looks and how readable it is. This list teaches color theory for UI and web typography in a practical order, then gives you the best free tools: color palette generators, contrast checkers, OKLCH pickers, type scale calculators, font pairing references and fluid type tools. Paid items are marked (paid).
Table of contents
- Learning path
- Part 1: Color
- Part 2: Typography
- Design tokens for color and type
- Books
- Exercises
- Cheat sheet
- FAQ
- Where to go next
- Contributing
Learning path
| Step | Focus | Time | Outcome |
|---|---|---|---|
| 1 | Color basics: hue, saturation, lightness, harmony | 2-3 days | Explain why a palette works |
| 2 | UI color roles: neutral, primary, semantic | 2-3 days | Map colors to jobs, not decoration |
| 3 | Contrast and accessibility | 2 days | Check every text/background pair |
| 4 | OKLCH and tonal scales | 3-4 days | Build a 10-12 step scale with even lightness |
| 5 | Typography basics: size, line height, measure | 3 days | Set readable body text |
| 6 | Type scales and hierarchy | 3 days | Build a scale and apply it to a real page |
| 7 | Font pairing and loading | 3 days | Pair 2 families and load them efficiently |
| 8 | Tokens and dark mode | 1 week | Ship a themeable token set |
About 4-5 weeks part-time.
Part 1: Color
Color theory for UI in plain words
- Hue is the color family (red, blue). Saturation/chroma is intensity. Lightness is how light or dark.
- Harmonies (complementary, analogous, triadic) are starting points, but most UIs are mostly neutral with one accent.
- 60-30-10 rule: roughly 60% dominant (background neutrals), 30% secondary (surfaces, text), 10% accent (calls to action). A guideline, not a law.
- Color has jobs. Primary = main action. Semantic = success, warning, danger, info. Neutral = text, borders, surfaces.
- Color is never the only signal. Pair it with text, icons or patterns (WCAG 1.4.1).
- Meaning varies by culture. Red can mean danger, luck or loss depending on market and context.
Color spaces: why OKLCH matters
| Space | Strength | Weakness |
|---|---|---|
| HEX / RGB | Universal, what screens use | Not intuitive to edit |
| HSL | Easy mental model | “Lightness” is not perceptual: yellow at 50% looks far lighter than blue at 50% |
| OKLCH | Perceptually even lightness; easy to build consistent scales; supports wide-gamut (P3) | Some colors fall outside sRGB and must be mapped |
| Display P3 | Wider, more vivid gamut on modern screens | Needs fallbacks for sRGB screens |
All modern browsers support oklch() in CSS. Example:
:root {
--brand-500: oklch(0.62 0.19 255); /* lightness, chroma, hue */
--brand-600: oklch(0.55 0.19 255); /* same hue and chroma, darker */
}
Tailwind CSS v4 defines its default palette in OKLCH. Learn more:
- OKLCH in CSS: why we moved from RGB and HSL (Evil Martians)
- MDN: oklch()
- A perceptual color space for image processing - the original Oklab write-up
- OKLCH Color Picker
Building a UI palette step by step
- Pick one brand hue. Start from the brand, or choose one that suits the product’s tone.
- Generate a tonal scale (for example 50-950, 11 steps) with even perceived lightness using an OKLCH-based tool.
- Build a neutral scale, ideally tinted slightly toward your brand hue (very low chroma).
- Add semantic hues: green/success, amber/warning, red/danger, blue/info, each as a short scale.
- Assign roles with semantic tokens:
bg,bg-subtle,surface,border,text,text-muted,accent,accent-hover,danger. - Check contrast for every text and UI pair you actually use.
- Create dark mode by remapping roles, not inverting colors.
- Test with real content and in color-blindness simulators.
Example role table:
| Role | Light mode | Dark mode |
|---|---|---|
| bg | neutral-50 | neutral-950 |
| surface | white | neutral-900 |
| border | neutral-200 | neutral-800 |
| text | neutral-900 | neutral-50 |
| text-muted | neutral-600 | neutral-400 |
| accent | brand-600 | brand-400 |
| accent-text-on | white | neutral-950 |
Contrast and accessibility
WCAG 2.x (the legal and audit baseline today):
| What | Level AA | Level AAA |
|---|---|---|
| Normal text | 4.5:1 | 7:1 |
| Large text (24px, or 18.66px bold) | 3:1 | 4.5:1 |
| UI components and meaningful graphics | 3:1 | - |
APCA (Accessible Perceptual Contrast Algorithm) is a newer model that accounts for font size, weight and polarity. It was explored for WCAG 3, but WCAG 3 is still a Working Draft and its contrast method is not settled. Use WCAG 2 ratios for compliance; APCA can be a useful extra check for readability.
| Tool | Notes |
|---|---|
| WebAIM Contrast Checker | The quick standard |
| Who Can Use | Shows who can read a color pair, by vision type |
| Colour Contrast Analyser | Free desktop app with eyedropper (TPGi) |
| APCA Contrast Calculator | APCA readability checks |
| Accessible Palette | Build scales where each step has predictable contrast |
| Leonardo | Adobe’s open-source tool to generate colors by target contrast ratio |
| Coblis | Color-blindness simulator |
| Chrome DevTools | Rendering tab > Emulate vision deficiencies |
More in the companion repo awesome-web-accessibility.
Dark mode
- Use dark grey surfaces (not pure black) for most UIs; pure black can work for OLED-first designs.
- Express elevation with lighter surfaces, not just shadows.
- Desaturate accents slightly; saturated colors vibrate on dark backgrounds.
- Re-check contrast; light text on dark often needs a slightly lower weight to avoid looking bold.
- Respect the user’s choice with
prefers-color-scheme, and offer a toggle.
:root { color-scheme: light dark; }
:root { --bg: oklch(0.98 0.005 255); --text: oklch(0.22 0.02 255); }
@media (prefers-color-scheme: dark) {
:root { --bg: oklch(0.18 0.01 255); --text: oklch(0.95 0.005 255); }
}
body { background: var(--bg); color: var(--text); }
Guides: Material Design 3: color roles, Apple HIG: Dark Mode.
Palette generators
| Tool | Best for | Cost |
|---|---|---|
| Coolors | Fast random palettes, locking, exporting | Free; paid Pro |
| Adobe Color | Harmony rules, extract from images, accessibility checks | Free |
| Realtime Colors | Seeing a palette on a real site layout, then exporting CSS/Tailwind | Free |
| Huemint | ML-generated palettes on brand mockups | Free |
| Khroma | Palettes tuned to your taste | Free |
| Paletton | Classic color wheel harmonies | Free |
| Colormind | ML palettes from images and film | Free |
| Color Hunt | Curated community palettes | Free |
Scale and system tools
| Tool | What it does | Cost |
|---|---|---|
| UI Colors | Tailwind-style 50-950 scale from one hex | Free |
| Radix Colors | 12-step scales with clear role guidance and dark mode | Free, MIT |
| Tailwind CSS colors | A well-tuned default palette in OKLCH | Free |
| Open Color | Open-source UI color scheme | Free, MIT |
| Material Theme Builder | Material 3 dynamic color schemes from a source color | Free |
| Huetone | Edit palettes in LCH/OKLCH with contrast checks | Free |
| Atmos | Palette and scale tool | Free tier; paid |
| Leonardo | Contrast-based adaptive themes | Free, open source |
Best pick: Radix Colors if you want a ready, proven scale; UI Colors or Leonardo to build your own from a brand color.
Color guides and articles
- Material Design 3: color system - roles, tonal palettes and dynamic color
- Learn UI Design: Color in UI Design, a practical framework
- Refactoring UI: Building your color palette
- Make beautiful gradients (joshwcomeau.com)
- MDN: Applying color to HTML elements
- Radix Colors: understanding the scale
Data visualization color
| Resource | Use |
|---|---|
| ColorBrewer 2.0 | Sequential, diverging and qualitative palettes for maps and charts, with colorblind-safe filters |
| Viz Palette | Test chart palettes for distinguishability |
| Datawrapper blog: colors | How to choose colors for data viz |
| Scientific colour maps | Perceptually uniform, colorblind-friendly maps |
Part 2: Typography
Typography basics for UI
| Property | Good default | Why |
|---|---|---|
| Body size | 16px on web (often 16-18px) | Browser default; readable on most screens |
| Line height (body) | 1.4-1.6 | Room between lines aids reading |
| Line height (headings) | 1.1-1.3 | Large text needs less |
| Measure (line length) | About 45-80 characters, ~66 ideal | Long lines tire the eye |
| Paragraph spacing | Roughly equal to the line height | Clear separation |
| Weights | 2-3 per family (e.g. 400, 600, 700) | Hierarchy without noise |
| Letter spacing | Slightly negative on big headings, slightly positive on small caps/labels | Optical balance |
| Alignment | Left-aligned (in LTR languages) for body | Justified text causes uneven gaps on the web |
Hierarchy comes from size, weight, color and spacing together, not size alone.
body {
font-family: Inter, system-ui, sans-serif;
font-size: 1rem;
line-height: 1.55;
text-rendering: optimizeLegibility;
}
.prose { max-width: 66ch; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
p { text-wrap: pretty; }
text-wrap: balance and text-wrap: pretty improve headings and paragraph endings in modern browsers (MDN: text-wrap).
Type scales
A type scale multiplies a base size by a ratio.
| Ratio | Name | Feel | Good for |
|---|---|---|---|
| 1.125 | Major second | Subtle | Dense apps, dashboards |
| 1.2 | Minor third | Balanced | Most product UIs |
| 1.25 | Major third | Clear | Marketing sites, docs |
| 1.333 | Perfect fourth | Strong | Editorial, landing pages |
| 1.5 | Perfect fifth | Dramatic | Big headlines, few levels |
| 1.618 | Golden ratio | Very dramatic | Posters, hero sections |
Example with base 16px and ratio 1.25: 12.8, 16, 20, 25, 31.25, 39, 48.8 px. Round to whole pixels or rem values you like; scales are a guide.
Many product teams use a hand-tuned scale instead (e.g. 12, 14, 16, 18, 20, 24, 30, 36, 48, 60). See Material 3 type scale and Tailwind font sizes for proven examples.
Tools: Typescale, Modular Scale.
Fluid typography
Fluid type grows smoothly between a minimum and maximum viewport using clamp():
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.5rem); }
Always include a rem part so text still responds to user zoom (WCAG 1.4.4).
| Tool | What |
|---|---|
| Utopia | Fluid type and space scales, with a clear method |
| Fluid Type Scale Calculator | Generate clamp() scales |
Font pairing
Principles:
- One family is often enough. A good superfamily (Inter, IBM Plex, Source) gives weights, widths and a mono.
- Pair by contrast, not similarity. A serif headline with a sans body, or a geometric display with a humanist text face.
- Match x-height and mood. Fonts with similar x-heights sit well together.
- Limit to two families (plus a monospace for code).
- Test with real content, including numbers, punctuation and other languages you support.
Proven free pairings:
| Headings | Body | Mood |
|---|---|---|
| Fraunces | Inter | Warm editorial + clean UI |
| Playfair Display | Source Sans 3 | Classic magazine |
| Space Grotesk | Inter | Tech, startup |
| IBM Plex Serif | IBM Plex Sans | Corporate, coherent superfamily |
| DM Serif Display | DM Sans | Friendly, modern |
| Merriweather | Open Sans | Readable long-form |
| Manrope | Manrope | Single-family product UI |
| Literata | Atkinson Hyperlegible | Reading and accessibility focus |
Pairing references:
- Fontjoy - generates pairings
- Typewolf - what fonts real sites use, plus recommendations
- Fonts In Use - archive of typography in real projects
- Google Fonts: pairing guidance - in Google Fonts Knowledge
Variable fonts and font loading
Variable fonts put many weights and widths in one file, with smooth axes (wght, wdth, opsz, slnt, plus custom axes).
@font-face {
font-family: "Inter";
src: url("/fonts/InterVariable.woff2") format("woff2");
font-weight: 100 900;
font-display: swap;
}
h1 { font-weight: 750; font-optical-sizing: auto; }
Loading tips:
- Self-host WOFF2; subset to the languages you need.
- Use
font-display: swap(oroptionalfor non-critical fonts). - Preload only the one or two most important files.
- Reduce layout shift with metric-matched fallbacks (
size-adjust,ascent-override); tools below help. - Consider a system font stack for app UIs where performance matters most.
| Resource | What |
|---|---|
| web.dev: Best practices for fonts | Loading performance |
| MDN: Variable fonts guide | How to use axes |
| v-fonts.com | Directory of variable fonts to try |
| Wakamai Fondue | Drop a font file to see its features, axes and generated CSS |
| Capsize | Trim text box whitespace for exact spacing |
| Font Style Matcher | Match a fallback font to reduce layout shift |
| Fontsource | Self-host open-source fonts via npm |
| Modern Font Stacks | System font stacks by style, no downloads |
Where to find fonts
| Source | Notes |
|---|---|
| Google Fonts | 1,800+ open-source families |
| Fontshare | Free high-quality fonts for commercial use |
| Bunny Fonts | Privacy-friendly Google Fonts alternative |
| Velvetyne | Experimental libre fonts |
| The League of Moveable Type | Open-source classics |
| Adobe Fonts | Included with paid Creative Cloud |
| Commercial foundries (Klim, Commercial Type, Grilli Type, Dinamo, and others) | Paid licenses; often worth it for brands |
For many more free asset sources, see free-design-resources.
Typography tools
| Tool | What it does |
|---|---|
| Typescale | Preview modular scales with your fonts |
| Utopia | Fluid type and spacing |
| Wakamai Fondue | Inspect any font’s features |
| Font Style Matcher | Match fallback fonts |
| Capsize | Precise text box trimming |
| Fontjoy | Pairing generator |
| Typewolf | Recommendations and real examples |
| WhatTheFont | Identify a font from an image |
| Google Fonts Knowledge | Free lessons from basics to advanced |
Typography guides and references
| Resource | Type | Cost |
|---|---|---|
| Butterick’s Practical Typography | Online book | Free to read (pay-what-you-want) |
| Google Fonts Knowledge | Lessons and glossary | Free |
| The Elements of Typographic Style Applied to the Web | Classic principles translated to CSS | Free |
| Material Design 3: typography | System guidance | Free |
| Apple HIG: Typography | Platform guidance and Dynamic Type | Free |
| Smashing Magazine: typography | Articles | Free |
| Pimp my Type | Practical type articles and videos | Free; courses paid |
| I Love Typography | Long-running type magazine | Free |
Design tokens for color and type
Use primitive tokens for raw values and semantic tokens for roles. Components only use semantic tokens.
{
"color": {
"blue": {
"500": { "$type": "color", "$value": "#3b6fe0" },
"600": { "$type": "color", "$value": "#2f59b8" }
},
"accent": { "$type": "color", "$value": "{color.blue.600}" }
},
"font": {
"family": {
"body": { "$type": "fontFamily", "$value": ["Inter", "system-ui", "sans-serif"] }
},
"size": {
"base": { "$type": "dimension", "$value": { "value": 1, "unit": "rem" } }
}
}
}
The format above follows the Design Tokens Community Group specification. Tools like Style Dictionary turn tokens into CSS, iOS and Android code, and Figma variables can mirror the same structure.
Books
| Book | Cost | Focus |
|---|---|---|
| Practical Typography by Matthew Butterick | Free online | Everyday typography rules |
| Thinking with Type, Ellen Lupton | Paid | Foundations of letters, text and grids |
| The Elements of Typographic Style, Robert Bringhurst | Paid | The classic reference |
| On Web Typography, Jason Santa Maria | Paid | Typography for the web |
| Refactoring UI, Adam Wathan and Steve Schoger | Paid | Practical color and type tactics for UI |
| Interaction of Color, Josef Albers | Paid | How colors affect each other (classic exercises) |
| Color and Light, James Gurney | Paid | Color from a painter’s view; useful intuition |
Exercises
- Palette from a photo: extract 5 colors with Adobe Color, then turn them into a usable UI palette with roles.
- OKLCH scale: build an 11-step brand scale by changing only lightness in OKLCH; compare with the same steps in HSL.
- Contrast table: list every text/background pair in a product and mark AA pass or fail. Fix the failures.
- Dark mode remap: take a light design and create dark mode by remapping roles. Re-check contrast.
- Type scale test: set one article with 1.2, 1.25 and 1.333 ratios. Which reads best on mobile and desktop?
- Measure test: set the same paragraph at 40, 66 and 100 characters per line and read each aloud.
- Pairing challenge: create three pairings for the same landing page (tech, editorial, playful).
- Fluid type: replace fixed breakpoint font sizes on a site with Utopia’s clamp() scale.
- Font loading audit: measure a site’s font bytes and layout shift; self-host and subset; measure again.
- Token pipeline: write tokens in DTCG JSON and generate CSS variables with Style Dictionary.
Cheat sheet
COLOR
- Mostly neutral + 1 accent + semantic colors
- Build scales in OKLCH for even lightness
- Text contrast >= 4.5:1, large text and UI >= 3:1 (WCAG 2 AA)
- Never color alone for meaning
- Dark mode = remap roles, lighter surfaces for elevation, softer accents
TYPE
- Body 16-18px, line-height 1.4-1.6, measure ~45-80ch
- One scale (e.g. 1.2 or 1.25), 2-3 weights
- Max 2 families + mono
- Use rem; fluid sizes with clamp() including a rem term
- WOFF2, font-display: swap, subset, preload sparingly
FAQ
What is the 60-30-10 rule? A guideline for color balance: about 60% dominant color, 30% secondary, 10% accent. In UI, the 60% is usually neutral backgrounds.
How many colors should a website have? Typically a neutral scale, one primary color scale and 3-4 semantic colors. Add a secondary accent only if it has a clear job.
What is OKLCH and should I use it? A perceptual color space where equal lightness values look equally light. It makes consistent scales and accessible contrast easier, and it works in all modern browsers.
What contrast ratio is required? WCAG 2 AA: 4.5:1 for normal text, 3:1 for large text and UI components.
Is APCA required? No. It is not part of any current legal standard. WCAG 3, which may use a new contrast method, is still a Working Draft.
What font size should body text be? 16px is the web default and a good minimum for most body text; 17-18px is common for reading-focused sites.
What is the best line height? About 1.5 for body text; tighter (1.1-1.3) for large headings.
How many fonts should I use? Usually one or two families, plus a monospace if you show code.
What are the best free fonts for UI? Inter, IBM Plex Sans, Source Sans 3, Manrope, Geist and Atkinson Hyperlegible are strong choices.
Should I use a system font stack? For app interfaces where speed and native feel matter, yes. For brand-led marketing sites, a custom font may be worth the bytes.
Serif or sans-serif for body text? Both work on modern screens. Choose by tone and test readability with real content.
Where to go next
- Full UI/UX roadmap: how-to-master-ui-ux
- Accessibility beyond contrast: awesome-web-accessibility
- Figma variables, styles and color plugins: awesome-figma-resources
- Free fonts, icons and imagery: free-design-resources
Contributing
Suggestions welcome. Add tools you have used, describe them in one line, mark paid items, and prefer free and open-source options. For claims about standards (WCAG, APCA), link the official source.
If this helped you, a star helps others find it.
License
Content is licensed under CC BY 4.0.
More free resources
Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.