04 / Illustrated reference / Refactoring UI · 16 October 2026
A practical guide to visual structure
An illustrated working summary of hierarchy, grouping, color, surfaces, responsive layout, and coherent theme personality.
This is a selective working summary of Refactoring UI for documentation themes. The examples below are original HTML. Page references identify the reviewed edition; the official book site provides public context. The book covers much more than this task, including product workflows, photos, and empty states.
1. Give the reader an obvious priority
Make the main task stand out by quieting competing information. Weight, tone, and spacing can establish hierarchy without enormous titles or tiny supporting text. Secondary information should remain readable.
Refactoring UI, pp. 36–47, 54–59 (page numbers match the supplied PDF).Reading notebook
A small collection of ideas from twelve chapters.
Updated today
Supporting text does not need to shrink
Updated yesterday · Python · A short example
Updated yesterday · Python · A short example
2. Make groups easier to recognize than gaps
Related elements need less space between them than unrelated groups. A heading should sit closer to the content it introduces. Consistent spacing values help the whole system feel intentional, but a rigid arithmetic formula does not replace visual judgment.
Refactoring UI, pp. 66–74, 96–99 (page numbers match the supplied PDF).A small working spacing vocabulary
An illustrative token set, not a required sequence from the book. Use fine steps for small controls and more distinct steps for larger spaces.
Generous outer space can be useful while paragraph leading is still too loose. “Whitespace” is not one interchangeable quantity: margins, line spacing, paragraph separation, and section gaps have different jobs.
3. Build a palette with readable roles
Use a small set of coherent tones for primary, secondary, and tertiary information. On colored surfaces, choose supporting text to work with that hue rather than adding a generic pale grey. Confirm contrast in the actual composition, and give meaning a cue besides color.
Refactoring UI, pp. 42–44, 142–160, 162–168 (page numbers match the supplied PDF).White on a pastel panel can look friendly while becoming hard to read.
Darker text on a pale surface keeps the palette, while the symbol and words carry the meaning.
Dark mode needs its own relationships
Main text remains strong. Supporting text can recede without vanishing.
Updated today · Notes on a chapter
Paper, panel, supporting text, accent, main text. Define a role for each tone, then check the foreground/background pairs that actually occur.
The book supports accessible color choices. For the current numeric requirements, use W3C’s WCAG contrast guidance. Do not use a pale disabled-looking control as a template for enabled actions.
4. Give each kind of content the width it needs
The full browser width is an available canvas, not an obligation. Paragraphs benefit from a controlled measure; tables, diagrams, and code may need more room. Refactoring UI suggests 45–75 characters for paragraphs, allowing some wider cases with care.
Refactoring UI, pp. 76–81, 114–116 (page numbers match the supplied PDF).A short paragraph can remain comfortable while a larger data display uses more of the available canvas. Different content widths can belong to the same coherent page.
Title Author Year A Room with a View E. M. Forster 1908 Pride and Prejudice Jane Austen 1813
Large and small elements need different responsive changes
Reduce large display elements more than already-small reading text. Keeping the same size ratios at every breakpoint can leave a phone with giant headings and tiny code. Line spacing should also respond to text size and measure rather than being uniform everywhere.
Refactoring UI, pp. 92–95, 122–125 (page numbers match the supplied PDF).A title fills the phone
The body shrinks to make room for the display.
find_books(library, "room")
A title makes room
The heading becomes quieter while the body remains comfortable.
find_books(library, "room")
5. Separate surfaces with the smallest useful signal
A border, a background shift, whitespace, or a shadow can each distinguish a group. Use the tool that fits the hierarchy. Flat designs can convey layers; decorative depth does not earn points by itself. Accent borders can add character without filling the whole component with intense color.
Refactoring UI, pp. 190–192, 224–226, 238–241 (page numbers match the supplied PDF).The group is clear through spacing and a quiet surface. One accent supplies enough emphasis.
Keep decoration behind the hierarchy
The book allows subtle gradients and patterns; the important constraint is that they support rather than interfere with content. A decorative header can carry the personality while long prose has a stable foreground/background relationship.
Refactoring UI, pp. 202–206, 228–232 (page numbers match the supplied PDF).A little visual character
The reading surface stays stable. The decorative background belongs to the surrounding frame, not to every line of text.
6. Make the personality consistent with the purpose
Type, color, shape, and language work together to suggest a character. A playful design is not inherently poor design, but it may be wrong for an elegant documentation site. Neutral sans, literary serif, and a warm dark palette can all be coherent directions.
Refactoring UI, pp. 20–26, 108–112 (page numbers match the supplied PDF).The reading room
Paper, a text serif, and a measured accent make a quiet editorial voice.
A useful system
A clean sans face, careful grouping, and one fine rule can feel precise without feeling generic.
After hours
A dark ink surface and a selective warm accent give the same content another mood.
These original examples echo the intended roles of Folio, Atelier, and Nocturne. They do not reproduce a layout from the book.
A theme review that leads to action
- Start with the actual task: reading, finding a section, understanding code, or using a control.
- Read the page in grey or with accents mentally removed. Is its hierarchy still clear?
- Check grouping before adding a divider, shadow, or more color.
- Inspect text on every surface, including secondary buttons, messages, captions, and code.
- Review both modes and narrow widths; do not shrink small text to preserve a desktop composition.
- Keep a few coherent tokens for space, type, surfaces, and accents. Verify the generated page, not only the token list.
The design assessment applies these principles to all 38 themes. The typography assessment supplies a separate, more prescriptive reading score.
Neither guide makes a mathematical ratio a substitute for judgment. The strongest evidence is a readable page, clear relationships, and a consistent response to real content.
Source
Adam Wathan and Steve Schoger, Refactoring UI, official book site. Page ranges above refer to the reviewed 252-page edition. The guidance has been selectively paraphrased for SmallDocs; illustrations, example copy, and this review’s score weights are original. No book PDF, page images, or extracts are distributed.