Design rules the build enforces

How dozens of sites share one kit without looking identical, and why each site's build fails if its color theme would be hard to read.

Updated

Sites that share a kit tend to look like copies of each other, and a network of obvious copies looks like spam. Each site here sets its own colors, typefaces and layout, and the build refuses to finish if the chosen colors would make text hard to read.

What a site chooses

Each site makes four decisions.

  • A theme of seven colors. Background, a raised surface, body text, secondary text, an accent, the text that sits on the accent, and a hairline color.
  • Two typefaces. One for headings, one for body text.
  • A layout. Three settings with three options each: the style of the header, the style of the home page headline and the style of the lists.
  • One signature detail. A short stylesheet for something drawn from the subject, such as ruled lines on a study site or measuring ticks on a framing site.

The guidance is to take colors from the subject's own world and to avoid stock looks that appear on every template.

The contrast check

A free choice of colors invites unreadable pages: pale gray text on white, or a link color that disappears into its background. So the kit measures every theme when a site is defined, using the contrast ratio from the Web Content Accessibility Guidelines.

Pair Minimum ratio
Body text on the background 7:1
Body text on the surface color 7:1
Secondary text on the background 4.5:1
Accent on the background 4.5:1
Text on the accent color 4.5:1

If any pair falls short, the build stops with a message naming the pair, the ratio it measured and the ratio it needs. A site cannot ship with a theme that fails.

Why make it a build failure

A written guideline is easy to skip under time pressure. A failed build cannot be skipped. Putting the rule in code means nobody has to remember it, review for it or argue about it, and it holds for the fiftieth site as firmly as for the first.

It also makes bold choices safer. A site can use a dark red background or a deep navy one, as long as the numbers hold.

Keeping custom styles honest

The per-site stylesheet could undo all of this, so it has rules of its own. It uses the theme's color variables and never introduces new text colors. It is CSS only, with no images or outside files. Nothing animates by itself. And the effort goes into one detail, with the rest of the page left quiet so the text stays easy to read.

What is still judgment

The check proves that text is readable. It does not prove a site looks good, or that two sites look different enough from each other. That part still needs a person to open the sites side by side and look.

For how the kit and the sites fit together, see one repository, one kit, many sites.