Back to Field Notes
Deep dive

Design System v2: measured contrast, one button, and tokens Desk can't see

An audit of our own CSS found four WCAG AA contrast failures and body text that had never rendered in Inter. Design System v2 fixed the site and portal, reached Frappe Desk with tokens scoped so Desk's own styles stay untouched, and reached the Kremio app a day later.

Covers
Written
Repositories
infinary.io, infinary_controls, kremio
Status
Shipped
Reading time
5 min
#design-system#marketing-site#portal#infinary-controls#kremio#frappe
Contents

The audit

On Thursday, October 15, we audited our design system as it actually shipped: the brand CSS and design docs, the site and portal styles, the live site, and the Aria and Kremio pages that Infinary Controls draws inside (Frappe's built-in web interface, where people use ERPNext in a browser.). Fifteen findings. The ones that mattered were measured, not matters of taste:

Nikolas approved the proposal the same day. The brand itself didn’t change.

The site and the portal

  • Contrast-safe pairs. Primary fills moved to #0062CC, with white on it at 5.80:1. Small blue text moved to #3D96FF (5.87:1), copper and danger buttons carry dark labels (4.64:1 and 5.21:1), and small copper text moved to #C9874A (5.36:1).
  • One button style: Fira Code 700, uppercase, .1em tracking, at 12, 13 or 15px.
  • An 11px floor. About 1,070 text sizes under 11px became 11px.
  • Copper means money, so form errors moved to the danger red.
  • A shared tokens.css holds the semantic layer (ground, surfaces, ink, accent fills, state tints) for Carbon and a new light theme, Steel. It’s plain CSS so other repositories can vendor it.
0246:1White on primary blueSmall blue textCopper button labelDanger button labelbefore, White on primary blue: 4.0before, Small blue text: 4.4before, Copper button label: 3.8before, Danger button label: 3.4after, White on primary blue: 5.8after, Small blue text: 5.9after, Copper button label: 4.6after, Danger button label: 5.2WCAG AA: 4.5:1beforeafter
0246:1White on primary blueSmall blue textCopper button labelDanger button labelbefore, White on primary blue: 4.0before, Small blue text: 4.4before, Copper button label: 3.8before, Danger button label: 3.4after, White on primary blue: 5.8after, Small blue text: 5.9after, Copper button label: 4.6after, Danger button label: 5.2WCAG AA: 4.5:1beforeafter
The four failing pairs, before and after (contrast ratio) White on the primary blue went from 3.98 to 5.80. Small blue text on Carbon went from 4.42 to 5.87. The label on copper buttons went from 3.79 to 4.64. The label on danger buttons went from 3.38 to 5.21. All four were under the 4.5 AA line before and are over it after.
Show data
beforeafter
White on primary blue3.985.8
Small blue text4.425.87
Copper button label3.794.64
Danger button label3.385.21

A codemod that only changed class tokens did most of the edits. We checked the builds and scanned six pages at 1280px and 375px for overflow and for text under 11px. We didn’t visually check the signed-in portal pages; only the login page was looked at.

Frappe Desk: never on :root

Infinary Controls vendors the file with a script that changes only the selectors. :root becomes .infinary-ds, [data-theme="dark"] becomes [data-theme="dark"] .infinary-ds, and each of our surfaces puts .infinary-ds on its root element. A test pins the vendored file to a byte-for-byte copy of the source and checks that nothing Desk loads is declared on :root, and a --check mode compares it with the website repository’s main branch. On a bench, Desk’s own --radius was still 8px.

Desk had its own surprises. It styles code dark purple, unreadable on Carbon, and its .btn is rounded, so our controls set border-radius: 0 explicitly. Our pages follow Frappe’s data-theme on <html>: Steel when Desk is light, Carbon when it’s dark.

Infinary Controls 0.11.0 went live on our own site that evening. We checked it in a signed-in browser: Fira Code loaded, square solid buttons, 11px labels, Desk’s own radius untouched. We haven’t yet seen Steel on our own site, because the desk we checked is set to dark.

Fixing one pill exposed four more

Measured over every surface, the AI pill read 3.80:1 on Carbon’s raised surface. Its ink moved to a lighter violet, #C383FF, at 4.64:1. The same measurement then found four more pills under 4.5:1, for danger, money, live and warn. We moved each one’s ink by the least that clears 4.6:1 over every surface and left the tints alone. An end-to-end check now measures all five pills over four surfaces in both themes.

The same change fixed a bug on the live site. --grid-dot sat in a plain :root, and the site’s terminal mode overrides it inside @layer base. Declarations outside any layer beat layered ones whatever their specificity, so terminal mode’s cyan grid had never shown. The brand values now live in @layer theme.

The Kremio app

The app had copied Frappe’s look: greys, rounded corners, the system font. On October 16 it moved to v2.

  • Tokens are generated from the shared file, by a script with a --check mode, and pinned by a test, not copied.
  • Inter and Fira Code are built into the app with Expo’s font config plugin rather than loaded at launch, so a cold start doesn’t wait for them. Files are named by PostScript name, because Android finds a font by file name and iOS by PostScript name. Styles set fontFamily and never fontWeight, because on Android a weight on a single-weight custom font fakes a bolder one.
  • Tests hold the rules. One fails on any borderRadius, any fontWeight or any size under 11. Another measures every text token on every surface in both themes, and every pill on its tint; nothing is under 4.5:1.
  • One exception, Nikolas’s call: controls Android draws itself, such as switches, date pickers and dialogs, keep their own shape in v2 colours. Squaring them off would cost accessibility and familiarity for little gain.

On the emulator, the switch on Check fields had no colours set, and its off track was nearly invisible on Carbon. Both tracks now have colours, checked at 3:1. The new look reached the app’s 0.4.0 Android test build that evening.

What we’d tell someone else