StyleKit

Frontend Encyclopedia

Frontend Foundations

Everything that makes interfaces look good, in one place — color, type, scale, spacing, design principles, and visual hierarchy. Not just the materials, but the why. The visual system of the front end, on a single page.

Foundations · System Layer

Color Theory

Good color isn't guesswork — it rests on hue, saturation, and lightness, plus a set of derivable harmony relationships. Learn the principles, take the tools.

01

Principle: The HSL Model

Every color decomposes into hue (which color), saturation (how vivid), and lightness (how bright). Drag to feel each axis.

#2662d9 · hsl(220, 70%, 50%)
wheel position, 0-360°
220
0=gray, 100=vivid
70
0=black, 50=pure, 100=white
50
02

Harmony Generator

From the base color above, fixed angles on the wheel yield harmonious palettes. Click any to copy CSS variables.

Complementary
Split Complementary
Analogous
Triadic
Tetradic
Monochromatic
03

Contrast Checker (WCAG)

Text-to-background contrast drives readability. WCAG wants at least 4.5:1 (AA) for body text, 7:1 (AAA) ideal.

Readability preview Aa

#1f2937
#ffffff
14.68:1
AAA

Passes — safe for text.

04

Usage Guide

Beyond principles, a few rules of thumb make any palette look intentional.

The 60-30-10 Rule

60% dominant, 30% secondary, 10% accent — balanced with a focal point.

Warm vs Cool

Warm hues advance and energize; cool hues recede and calm.

Semantic Colors

Users carry fixed expectations for these — don't fight them.

Success
#22c55e
Warning
#eab308
Error
#ef4444
Info
#3b82f6

Curated Type Directions

Fonts with a point of view

A tightly edited collection of open-source font pairings for real interface styles. Compare letterforms, understand where each pairing belongs, then copy production-ready CSS or Tailwind tokens.

Preview size

Showing 41 pairings

ElegantGloock × Manrope
Aa Gg Qq Rg 0123 &?

Maison & Atelier

Refined contrast and graceful proportion lend a quiet luxury to fashion, beauty, and premium editorial work.

Gallery Gloock

OFL

ClassicAlegreya × Source Sans 3
Aa Gg Qq Rg 0123 &?

Timeless by Design

Considered typography that endures. Every letterform carries tradition while remaining comfortable for long-form reading.

Literary Archive

OFL

ClassicYeseva One × Karla
Aa Gg Qq Rg 0123 &?

Timeless by Design

Considered typography that endures. Every letterform carries tradition while remaining comfortable for long-form reading.

Yeseva Salon

OFL

ModernBricolage Grotesque × Albert Sans
Aa Gg Qq Rg 0123 &?

Built for Tomorrow

Clean lines and confident spacing shape interfaces that feel effortless, fast, and unmistakably current.

Bricolage Studio

OFL

ModernArchivo Black × Archivo
Aa Gg Qq Rg 0123 &?

Built for Tomorrow

Clean lines and confident spacing shape interfaces that feel effortless, fast, and unmistakably current.

Archivo Poster

OFL

PlayfulDela Gothic One × Nunito Sans
Aa Gg Qq Rg 0123 &?

Hello, Sunshine!

Bright, friendly type for products that keep the experience light without becoming childish.

Dela Pop

OFL

EditorialYoung Serif × Work Sans
Aa Gg Qq Rg 0123 &?

The Morning Edition

Long-form reading deserves rhythm and contrast. A serif headline sets the tone; the body face carries the story.

Young Art Book

OFL

EditorialKalnia × Commissioner
Aa Gg Qq Rg 0123 &?

The Morning Edition

Long-form reading deserves rhythm and contrast. A serif headline sets the tone; the body face carries the story.

Kalnia Museum

OFL

TechnicalFragment Mono × Albert Sans
Aa Gg Qq Rg 0123 &?

System Architecture

Monospace precision meets readable prose for documentation, dashboards, and dependable technical interfaces.

Fragment Signal

OFL

TechnicalAzeret Mono × Public Sans
Aa Gg Qq Rg 0123 &?

System Architecture

Monospace precision meets readable prose for documentation, dashboards, and dependable technical interfaces.

Azeret Systems

OFL

DisplayUnbounded × Manrope
BEYOND
Aa Gg Qq Rg 0123 &?

Unbounded Future

OFL

DisplayBungee × Archivo
BLOCK PARTY
Aa Gg Qq Rg 0123 &?

Bungee Street

OFL

DisplayLimelight × Karla
CINEMA
Aa Gg Qq Rg 0123 &?

Limelight Deco

OFL

DisplayGrenze Gotisch × Manrope
NOCTURNE
Aa Gg Qq Rg 0123 &?

Grenze Nocturne

OFL

HandwrittenShantell Sans × Atkinson Hyperlegible
Made by hand
Aa Gg Qq Rg 0123 &?

Shantell Workshop

OFL

ModernSora × Figtree
Aa Gg Qq Rg 0123 &?

Built for Tomorrow

Clean lines and confident spacing shape interfaces that feel effortless, fast, and unmistakably current.

Sora Product

OFL

ModernEpilogue × Hanken Grotesk
Aa Gg Qq Rg 0123 &?

Built for Tomorrow

Clean lines and confident spacing shape interfaces that feel effortless, fast, and unmistakably current.

Epilogue Grotesk

OFL

TechnicalIBM Plex Sans × IBM Plex Sans
Aa Gg Qq Rg 0123 &?

System Architecture

Monospace precision meets readable prose for documentation, dashboards, and dependable technical interfaces.

Plex Technical

OFL

DisplaySyne × Hanken Grotesk
AVANT
Aa Gg Qq Rg 0123 &?

Syne Avant

OFL

ClassicLibre Caslon Display × Source Sans 3
Aa Gg Qq Rg 0123 &?

Timeless by Design

Considered typography that endures. Every letterform carries tradition while remaining comfortable for long-form reading.

Caslon Journal

OFL

EditorialNewsreader × Figtree
Aa Gg Qq Rg 0123 &?

The Morning Edition

Long-form reading deserves rhythm and contrast. A serif headline sets the tone; the body face carries the story.

Newsreader Editorial

OFL

ClassicSpectral × Work Sans
Aa Gg Qq Rg 0123 &?

Timeless by Design

Considered typography that endures. Every letterform carries tradition while remaining comfortable for long-form reading.

Spectral Reader

OFL

ModernOutfit × Figtree
Aa Gg Qq Rg 0123 &?

Built for Tomorrow

Clean lines and confident spacing shape interfaces that feel effortless, fast, and unmistakably current.

Outfit Clean

OFL

PlayfulGabarito × Hanken Grotesk
Aa Gg Qq Rg 0123 &?

Hello, Sunshine!

Bright, friendly type for products that keep the experience light without becoming childish.

Gabarito Pop

OFL

TechnicalSpace Mono × Sora
Aa Gg Qq Rg 0123 &?

System Architecture

Monospace precision meets readable prose for documentation, dashboards, and dependable technical interfaces.

Mono Terminal

OFL

DisplayNabla × Manrope
AURORA
Aa Gg Qq Rg 0123 &?

Chromatic Nabla

OFL

DisplayHonk × Work Sans
BLOCK PARTY
Aa Gg Qq Rg 0123 &?

Carnival Honk

OFL

DisplaySixtyfour × IBM Plex Sans
GAME OVER
Aa Gg Qq Rg 0123 &?

Arcade Sixtyfour

OFL

TechnicalDoto × Sora
Aa Gg Qq Rg 0123 &?

System Architecture

Monospace precision meets readable prose for documentation, dashboards, and dependable technical interfaces.

Matrix Doto

OFL

PlayfulPixelify Sans × Nunito Sans
Aa Gg Qq Rg 0123 &?

Hello, Sunshine!

Bright, friendly type for products that keep the experience light without becoming childish.

Pixel Play

OFL

DisplayJacquarda Bastarda 9 × Spectral
MIDNIGHT
Aa Gg Qq Rg 0123 &?

Gothic Jacquard

OFL

DisplayRubik Glitch × Hanken Grotesk
SIGNAL LOST
Aa Gg Qq Rg 0123 &?

Signal Glitch

OFL

DisplayMonoton × Karla
OPEN LATE
Aa Gg Qq Rg 0123 &?

Neon Monoton

OFL

PlayfulBagel Fat One × Figtree
Aa Gg Qq Rg 0123 &?

Hello, Sunshine!

Bright, friendly type for products that keep the experience light without becoming childish.

Chubby Bagel

OFL

ElegantBodoni Moda × Public Sans
Aa Gg Qq Rg 0123 &?

Maison & Atelier

Refined contrast and graceful proportion lend a quiet luxury to fashion, beauty, and premium editorial work.

Vogue Bodoni

OFL

ElegantCinzel × Source Sans 3
Aa Gg Qq Rg 0123 &?

Maison & Atelier

Refined contrast and graceful proportion lend a quiet luxury to fashion, beauty, and premium editorial work.

Roman Cinzel

OFL

ElegantCormorant Garamond × Karla
Aa Gg Qq Rg 0123 &?

Maison & Atelier

Refined contrast and graceful proportion lend a quiet luxury to fashion, beauty, and premium editorial work.

Salon Cormorant

OFL

DisplayBig Shoulders Display × Public Sans
BUILT CITY
Aa Gg Qq Rg 0123 &?

Civic Big Shoulders

OFL

TechnicalMartian Mono × IBM Plex Sans
Aa Gg Qq Rg 0123 &?

System Architecture

Monospace precision meets readable prose for documentation, dashboards, and dependable technical interfaces.

Mission Martian

OFL

ModernGeist × Geist
Aa Gg Qq Rg 0123 &?

Built for Tomorrow

Clean lines and confident spacing shape interfaces that feel effortless, fast, and unmistakably current.

Product Geist

OFL

HandwrittenPlaywrite AU SA × Source Sans 3
Dear you,
Aa Gg Qq Rg 0123 &?

Notebook Playwrite

OFL

System layer · Typography

Type Scale

Font sizes should not be guesswork. A modular scale derives every step from one base by a fixed ratio, giving the whole system a single mathematical relationship — then clamp() makes it scale fluidly with the viewport, no breakpoints.

1. The principle: modular scale

size = base × ratiostep
16px× 1.25 →
20px× 1.25 →
25px× 1.25 →
31px

With base 16px and ratio 1.25 (Major Third), each step is 1.25× the previous. Use 16px as the base (not 14/15px) — it is the browser's default body size.

2. Interactive generator

Mode
Ratio

Standard — most products (Stripe/Material)

5xl
The spectrum of scale
61.04px · 3.8147rem
4xl
The spectrum of scale
48.83px · 3.0518rem
3xl
The spectrum of scale
39.06px · 2.4414rem
2xl
The spectrum of scale
31.25px · 1.9531rem
xl
The spectrum of scale
25px · 1.5625rem
lg
The spectrum of scale
20px · 1.25rem
base
The spectrum of scale
16px · 1rem
sm
The spectrum of scale
12.8px · 0.8rem
xs
The spectrum of scale
10.24px · 0.64rem

3. Copyable tokens

CSS variables
:root {
  --text-xs: 0.64rem; /* 10.24px */
  --text-sm: 0.8rem; /* 12.8px */
  --text-base: 1rem; /* 16px */
  --text-lg: 1.25rem; /* 20px */
  --text-xl: 1.5625rem; /* 25px */
  --text-2xl: 1.9531rem; /* 31.25px */
  --text-3xl: 2.4414rem; /* 39.06px */
  --text-4xl: 3.0518rem; /* 48.83px */
  --text-5xl: 3.8147rem; /* 61.04px */
}
Tailwind v4 @theme (static)
@theme {
  --text-xs: 0.64rem;
  --text-sm: 0.8rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5625rem;
  --text-2xl: 1.9531rem;
  --text-3xl: 2.4414rem;
  --text-4xl: 3.0518rem;
  --text-5xl: 3.8147rem;
}

4. Choosing a ratio

RatioBest for
1.125–1.2Dense UI, dashboards, data tables
1.25–1.333Most products, SaaS, docs
1.414–1.618Editorial, marketing, display-led
  • —Use 16px as the base — the browser default, the safe anchor for readability and accessibility.
  • —Map each heading level to a step on the scale, not an arbitrary px value.
  • —Keep body line length at 55–75ch; keep body size stable (not fluid) — only let display / heading scale fluidly.
  • —Tighten line-height as size grows: ~1.1 for large headings, ~1.5 for body — vertical rhythm tracks size.
  • —When unsure start at 1.25; raise the ratio if hierarchy feels flat. Don't force 1.618 onto a dense UI.

System layer · Layout

Spacing & Grid

Spacing is the rhythm of a layout. Snap every padding, margin, and gap to one 8-pixel grid and the page breathes as a system — instead of a pile of arbitrary 13px and 17px values.

1. The principle: the 8-point grid

8
16
24
32
48
64

Every value is a multiple of 8 (with 4px as a fine half-step). Why 8? The common screen densities — 1x, 1.5x, 2x, 3x — all divide 8 into whole pixels, so 8px padding renders pixel-perfect on phone, desktop, and retina alike, while 5px or 7px go soft from sub-pixel rounding.

2. Interactive

Grid base
0
0px · 0rem
xs
4px · 0.25rem
sm
8px · 0.5rem
md
16px · 1rem
lg
24px · 1.5rem
xl
32px · 2rem
2xl
48px · 3rem
3xl
64px · 4rem
4xl
96px · 6rem
5xl
128px · 8rem
Snap checker
pxOff-grid — snap to 16px

The rule: snap to the scale or extend the scale — never invent 13px in place.

Column grid

12 columns · 32px gutter · 24px margin. 12 divides into 2/3/4/6 — halves, thirds, quarters, sixths all align.

3. Copyable tokens

CSS variables
:root {
  --space-0: 0rem; /* 0px */
  --space-xs: 0.25rem; /* 4px */
  --space-sm: 0.5rem; /* 8px */
  --space-md: 1rem; /* 16px */
  --space-lg: 1.5rem; /* 24px */
  --space-xl: 2rem; /* 32px */
  --space-2xl: 3rem; /* 48px */
  --space-3xl: 4rem; /* 64px */
  --space-4xl: 6rem; /* 96px */
  --space-5xl: 8rem; /* 128px */
}
Tailwind v4 @theme
@theme {
  --spacing-0: 0rem;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;
  --spacing-4xl: 6rem;
  --spacing-5xl: 8rem;
}

4. Using the system

  • —Default to 8pt — mainstream and pixel-perfect across devices; drop to 4pt only for dense UI like dashboards and tables.
  • —Snap, don't invent: once one component uses 13px, the next uses 14px, and the rhythm collapses.
  • —Separate micro from macro: keep component-internal spacing stable on mobile; shrink page-level spacing on small screens.
  • —Lay out on a 12-column grid, 16–24px gutters, 24/16px desktop/mobile margins — gutters and margins are spacing tokens too.
  • —Common sizes land on the grid: buttons 40/48 tall, icons 16/24/32, card padding 16/24, touch targets at least 44x44.

System layer · Principles

The Four Principles · CRAP

Color, type, scale, and spacing give you correct elements; CRAP tells you how to organize them. Contrast, Repetition, Alignment, Proximity — four principles that turn a pile of correct tokens into a layout that reads as intentional.

1. The four principles

CContrast

If two elements are not the same, make them clearly different — never almost the same. Contrast creates hierarchy and pulls the eye to what matters.

Don't be timid — if elements differ, make them differ boldly.

RRepetition

Repeat visual elements — color, shape, type, spacing — throughout the design. Repetition builds unity and makes a layout feel like one system instead of scattered parts.

Reuse the same tokens everywhere — consistency reads as intention.

AAlignment

Every element should have a visual connection to something else on the page. Nothing is placed arbitrarily — shared edges and baselines create an invisible order the eye trusts.

Nothing floats — put everything on a shared edge or baseline.

PProximity

Group related items close together and push unrelated ones apart. Proximity turns scattered elements into a few clear units, cutting the work the reader's eye has to do.

Closeness equals relationship — group by meaning, not by gut.

2. Before / after

Flip the switch and watch the same content go from arbitrary to principled — the gap is visible at a glance.

CContrast
Build beautiful interfaces, faster

One typographic hierarchy beats ten captions.

RRepetition
AAlignment

Product name

A short one-line description

Try it now

PProximity
Emaildarling@stylekit.top
Phone+86 138 0000 0000
CityBeijing

3. Checklist & code

CRAP self-review

C — Contrast

  • Headings and body text have an obvious jump in size and weight, not a subtle one.
  • Primary and secondary actions carry clearly different visual weight.
  • Key information stands out by size, color, or weight — not by italics alone.

R — Repetition

  • Radius, shadow, and spacing all come from one shared token set.
  • Elements of the same kind share the same style — every card looks like a card.
  • Brand color and type recur across sections to tie the page together.

A — Alignment

  • Elements share alignment edges instead of each sitting on its own.
  • Avoid mixing centered and left-aligned text in the same block.
  • A grid or shared left edge constrains where things land.

P — Proximity

  • A label sits tight against the input it describes, not floating between two.
  • Related items form a group with more whitespace between groups than within.
  • Lonely, ungrouped elements are pulled into the unit they belong to.
C · Contrast
.title {
  font-size: 2.5rem;
  font-weight: 700;
}
.body {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
}
R · Repetition
:root {
  --radius: 8px;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}
.card {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
A · Alignment
.form {
  display: grid;
  gap: 12px;
}
.form > * {
  text-align: left;
}
P · Proximity
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

4. Using the principles

  • —Apply in order: group with Proximity, order with Alignment, unify with Repetition, then sharpen with Contrast. Structure first, emphasis last.
  • —Contrast's worst enemy is almost: if two things are not the same, make them very different, not slightly.
  • —Don't mix alignments: centered and left-aligned text in one block destroys the order.
  • —It maps to the elements: Contrast lands on scale/weight/color, Repetition and Proximity on spacing tokens, Alignment on the grid — CRAP is the usage, the other four blocks are the materials.

System layer · Attention

Visual Hierarchy

Visual hierarchy is control over the order the eye moves through a layout. Four levers — size, weight, color, and space — set each element's visual weight, and that weight decides where attention flows first.

1. The four levers

Size

Bigger elements are seen first — size is the loudest signal in the room.

Weight

Heavier strokes carry more visual mass and hold the eye longer.

Color

High contrast against the background jumps forward; muted tones recede.

Space

Whitespace and isolation give an element room to command attention.

2. The lever controller

Toggle the levers — the numbers on the left are the scan order, ranked live by visual weight. Switch them all off and everything goes flat, read top to bottom; switch them on and a clear order emerges.

Levers
3
NEW RELEASEEyebrow
1
Design that ships itselfTitle
4
A short paragraph that supports the headline without competing with it.Body
2
Button
5
Updated 2 days agoMeta

3. Copyable text levels

Freeze the hierarchy into three text tokens — primary, secondary, tertiary — separated by relative size, weight, and opacity instead of tuning each one by hand.

CSS text levels
.text-primary {
  font-size: 1.5rem;
  font-weight: 700;
  opacity: 1;
}
.text-secondary {
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.9;
}
.text-tertiary {
  font-size: 0.875rem;
  font-weight: 400;
  opacity: 0.6;
}

4. Using hierarchy

  • —One focal point per screen: decide where the eye must land first, then let everything else recede. Two competing firsts means no first.
  • —Keep it to 3-4 levels: primary, secondary, tertiary is usually enough — more levels dilute the contrast between each.
  • —Stack levers, but don't max them all: a title that is bigger and bolder is plenty — piling on color and space too overloads it.
  • —Don't rely on color alone: contrast fails for color-blind users, so anchor hierarchy in size or weight as well to stay accessible.