English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Refactoring UI Breakdown: AI Keeps Making Gradients Weirder Because Design Sense Is Constraint, Not Decoration

Forum topic · 小凯 · 2026-10-10

Summary

Why does AI-generated UI look off even when the code works? Because vague prompts like "make it look premium" describe a high-dimensional judgment, while "add a gradient" is a low-dimensional decorative tweak — the model is perturbing at the wrong layer. This post breaks down Refactoring UI (2018, self-published by Adam Wathan and Steve Schoger), a book that converts design intuition into explicit tactics: don't rely on font size alone, use HSL instead of hex, define 9–10 shade steps up front, prefer shadows and spacing over borders, and don't fill the whole screen. The deeper story is the sequel: Wathan built Tailwind CSS, encoding those tactics as tool defaults — a 4px spacing base, 288 color variables with 11 lightness levels, proportional line-heights, and tinted greys in oklch. For AI code generation, this matters: raw CSS gives the model unlimited freedom, while Tailwind locks spacing, typography, and color into enumerated tokens, raising the quality floor by removing degrees of freedom rather than making the model smarter. Practical takeaways: feed the book's tactics into system prompts or design specs, and use Tailwind's constrained tokens. Details verified against the official site (~30,000+ copies, Goodreads 4.68; $99/$149 pricing) and Tailwind's current theme file.

Refactoring UI Breakdown: AI Keeps Making Gradients Weirder Because Design Sense Is Constraint, Not Decoration

A scene that happens every day: you ask AI to build a page. The functionality works in minutes, but the UI is always slightly off — oversized bold text, red/green/blue buttons crammed together, forms stretched across the entire screen. You say "make it look more polished," and it swaps in a gradient — which keeps getting weirder. The mechanism behind this loop can be dissected: your "polished" is a high-dimensional judgment hiding in hierarchy, spacing rhythm, and lightness structure; "add a gradient" is a low-dimensional decorative operation. The AI isn't slacking — it just doesn't have a map.

At the end of 2018, a book drew that map: *Refactoring UI*, co-written by Adam Wathan and Steve Schoger. Wathan is the author of Tailwind CSS — an identity that matters later; Schoger is a designer who built hundreds of thousands of followers by posting UI fix tips on Twitter. The book starts from Wathan's own admission: "I know this looks bad, but I can't say why" — a self-described non-designer full-stack developer who, after years of working with designers, found that most of those "unsayable whys" can be written as explicit rules. The book's manifesto is one line: Design with tactics, not talent.

The Rules

Fifty chapters, two hundred-plus pages, nearly every chapter one rule plus before/after screenshots. A few examples:

  • Hierarchy — "Size isn't everything": don't rely on bigger fonts; adjusting weight and lightness is much quieter than size.
  • "Don't use grey text on colored backgrounds": grey on color always looks dirty; use a brighter step of the same hue family instead.
  • Layout — "You don't have to fill the whole screen": a full-screen form isn't grand, it's neglected. Give content a max width; let whitespace accumulate, then tighten.
  • Color — "Ditch hex for HSL": organize palettes by hue, saturation, lightness — not hex codes.
  • "Define your shades up front": set 9–10 lightness steps per color before starting; improvising colors always ends dirty.
  • "Don't let lightness kill your saturation": when lightening a color, compensate saturation, or buttons become garish red/green/blue.
  • Depth — "Use fewer borders": the first tool for separating two elements isn't a border — it's shadows, background contrast, or simply spacing.
  • Individually these look like common-sense fragments, but the book did one thing right: it pulled design entirely out of the "aesthetic talent" narrative and turned it into an executable checklist. That's why it sold so well — ~30,000+ copies per the official site, 4.68 on Goodreads, a self-published ebook at $99–$149 with no publisher and no discounts.

    The Sequel: From Book to Tool

    The really interesting part is what came after. Wathan took these rules and built Tailwind CSS, so the tactics didn't stay on paper — they were written line by line into a tool's defaults. Comparing Tailwind's current theme file against the book is nearly one-to-one:

  • "Establish a spacing and sizing system" → --spacing: 0.25rem — a 4px base; every spacing value is an integer multiple.
  • "Define your shades up front" → 288 color variables, each shipping with eleven lightness levels from 50 to 950.
  • "Line-height is proportional" → every font-size tier carries its own line-height — 12px text at 1x, base size at 1.5x, tighter as text grows.
  • "Greys don't have to be grey" → Tailwind's slate-900 in oklch: 20.8% lightness, 4.2% chroma — a blue-tinted grey, the literal implementation of that rule.
  • Even "Ditch hex for HSL" has evolved: newer Tailwind moved from HSL to the perceptually more uniform oklch.

The AI Connection

Applied to today's AI-writes-your-frontend scenario, this chain is the answer itself: in raw CSS, the model has unlimited freedom, so it dares to make gradients ever weirder. Tailwind locks spacing, type, and color into enumerated tokens — the AI can only pick from preset ladders. The design-quality floor isn't raised by making the model smarter; it's sealed by deleting degrees of freedom. Same structure as my earlier piece on Fast Browser Use: another fix for hallucination isn't training, it's interfaces that remove the domain.

The book teaches humans, the tool guards the engineering, and AI inherits both for free — a checklist written for people in 2018 became the factory default of every AI-generated page in 2026.

Practical Takeaways

Next time the UI looks off, two moves beat "make it more polished":

1. Write the rules into constraints: put a dozen tactics into the system prompt or your project's design spec, so the AI executes a checklist instead of perturbing randomly. 2. Use Tailwind directly: let the tokens block most wrong options for you.

My favorite chapter title: "Don't design too much." In the AI context, add a footnote: don't give it too much freedom either.

---

*Notes: the 30,000-copy sales figure and 4.68 rating are official-site self-reported numbers; the book was self-published in late 2018 at $99 (Essentials) / $149 (Complete bundle), team licensing extra. All quoted chapter titles were checked against the official table of contents; the Tailwind token comparison was verified against its current theme file.*

Tags

#refactoring-ui#tailwind-css#ui-design#design-systems#ai-code-generation#book-review#css#frontend

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/178635786