跪拜 Guibai
← All articles
Frontend · AIGC

Refactoring UI for Developers: One Settings Page at a Time

By 王若风 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Developers can immediately improve UI quality without hiring a designer by applying the book's concrete, measurable rules, and the included checklist gives a repeatable audit process that works on any existing page.

Summary

Developers who ship functional but visually cramped interfaces can pull a page back from "programmer aesthetic" without a redesign. The book *Refactoring UI* by Adam Wathan and Steve Schoger provides a stack of concrete tweaks: start from the core function rather than a layout shell, use real data to expose edge cases, and emphasize primary content by de-emphasizing secondary text. The article walks through these rules with specific numbers — spacing scales like 4-8-12-16-24-32-48, type scales like 12-14-16-18-20-24-30, line-height inverses, and HSL color adjustments that add hue to neutral grays.

Beyond the principles, the article condenses combat-tested patterns for common components: replace table borders with spacing, use horizontal bar charts instead of pies, expand hit areas to 40×40 CSS pixels, and use skeleton screens for loading. A five-minute checklist offers a fast audit: double the spacing, grayscale the secondary text, halve the borders, keep one primary button, and constrain max-width.

The guide also points to a Hacker News community hub built by the author, and notes the official book pricing: $99 for the essentials (218-page PDF plus 3 videos), $149 for the full set. The author suggests trying the free checklist first before spending the money.

Takeaways
— Start design from the core interaction, not from the page shell; keep early iterations low-fidelity in black-and-white.
— Replace placeholder text with real, extreme samples early to expose layout breakage like overflowing buttons.
— Use a combination of size, weight, and color to create hierarchy instead of relying on font size alone.
— Omit labels when the value is self-explanatory (e.g., email addresses); if labels are needed, emphasize the value.
— Keep only one prominent solid primary button per screen; demote secondary and destructive actions to outlined, text, or confirm-dialog styles.
— Build spacing with a fixed scale like 4, 8, 12, 16, 24, 32, 48; start with generous whitespace and reduce until comfortable.
— Use intra-group spacing (8px) tighter than inter-group spacing (24px) to visually associate labels with inputs.
— Align optical elements (icons in circles, icon-text pairs) by visual center, not mathematical bounding box.
— Set a type scale with jumps (12, 14, 16, 18, 20, 24...) and cap line length to about 45–75 characters (max-width: 65ch).
— Use line-height 1.5–1.75 for small text and 1.0–1.25 for headings.
— Enable tabular-nums for data-heavy tables and price displays, and de-emphasize currency symbols and decimals.
— Use HSL to create 8–10 lightness steps per color; shift light steps warmer, dark steps cooler.
— For dark mode, replace black shadows with brightness progression and a 1px white inner highlight.
— For common components: use fewer borders (shadow/spacing instead), single-column forms, horizontal bar charts, 40×40px click areas, and skeleton screens for loading.
— Run the five-minute checklist after any page: double spacing, gray secondary text, halve borders, keep one primary button, and add max-width.
Conclusions

The book's advice is deliberately incremental — the author sells it as a small settings-page fix rather than a full redesign, which lowers the barrier for developers who avoid design work.

The strong overlap between the article's concrete numbers (spacing scales, type scales, line-height ratios) and the examples in *Refactoring UI* suggests the book's value lies more in codifying measurable defaults than in abstract principles.

The article's promotion of a Hacker News community hub and the $99 price tag frames the book as a practical purchase for self-taught designers, but the checklist alone may deliver most of the immediate wins.

By suggesting developers mimic Stripe, Linear, and GitHub pixel-for-pixel, the author implicitly endorses learning UI through reverse-engineering rather than design theory, which fits a developer's existing debugging mental model.

Concepts & terms
Optical alignment
Adjusting element positions based on how the eye perceives them rather than mathematical centering. For example, a triangle inside a circle looks left when perfectly centered, so it must be shifted right slightly to appear balanced.
Two-layer shadow
Using a large soft diffuse shadow for spatial depth plus a small sharp contact shadow for surface grounding, creating a natural floating effect on buttons and cards. Higher elevation means larger offset and blur, but lower opacity.
Skeleton screen
A loading placeholder that mimics the final layout with grayed-out blocks or shimmering bars, reducing layout shift and perceived wait time compared to a simple spinner.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗