page/design/scales.md
Scales
Spacing, font sizes, radii, shadows and line length come from short sets. What is counted, where the idea comes from, check settings.
An interface looks put together when sizes are taken not "by eye" but from short lists. Then neighboring values differ noticeably, and there is no need to decide each time between 13 and 14 px.
| Norm | What | Who holds it |
|---|---|---|
| SCL-R01 | Spacing is a multiple of 4 px (2 px below 16 px) | the spacing check |
| SCL-R02 | Font sizes from the scale, no more than 10 different ones | the type check |
| SCL-R03 | Radii from the set, shadows from the theme | the shape check |
| SCL-R04 | A line of text is 45–75 characters | judge and the measure sensor |
Where the ideas come from (in our own words)
- Refactoring UI (Adam Wathan and Steve Schoger, refactoringui.com). A system is worth setting in advance: spacing, font sizes, shadows as short lists in which neighboring values differ by at least a quarter. Choosing from five options is faster and more even than inventing a number. Five shadows are enough, from barely noticeable to the highest; each means "how far the element is above the page".
- The Material 3 type scale (m3.material.io). Fifteen text roles (display, headlines, titles, body, labels) in three sizes; each role has its own size, line height and weight. A role is named by purpose, not by number.
- Every Layout (Heydon Pickering and Andy Bell, every-layout.dev). Text width is set in
ch, the width of a character, and kept at about 60 characters; this rule is declared at the level of the whole project, not of each block. Spacing is derived from one step by multiplying it. - A line length of 45–75 characters is a rule of book typesetting (Robert Bringhurst, "The Elements of Typographic Style").
Settings
spacingBaseis the spacing step, px (4).spacingFineandspacingFineBeloware the fine step (2) for values below 16 px.typeScaleis the allowed font sizes, px.maxFontSizesis how many different sizes a project may have.radiiis the allowed radii, px; a "pill" (999 px and more) and percentages are always allowed.maxRadiiis how many different radii.maxShadowsis how many shadows a theme may have.measureis the limits of line length in characters.
Which files the checks look at is on the page Which files the design checks look at.
The package Design scales puts this page at
/design/scales.md.Source text