Module contrast
Expand description
The legibility half of the colour tokens.
FLOORS is the one table of contrast promises a theme makes to every
app: which foreground role must clear which ratio on which ground.
audit measures a colour set against it, Theme Studio refuses to save
a document with findings, and repair steps any foreground that still
misses (a hand-edited file) out until it holds, so a theme that reaches
the screen always keeps every floor. A high-contrast palette holds every
text floor at WCAG AAA (HIGH_CONTRAST_TEXT_MIN_CONTRAST).
Structs§
- Contrast
Finding - A floor a palette misses, and by how much.
- Contrast
Floor - One promise:
foregroundclearsmin_ratioagainstground.
Enums§
- Role
- A colour role a contrast floor is stated in. Grounds are surfaces and the selection lift; everything else is a foreground drawn on them.
Constants§
- BODY_
TEXT_ MIN_ CONTRAST - WCAG 2.x AA for body text.
- FLOORS
- Every promise, in the order findings are reported.
- HIGH_
CONTRAST_ TEXT_ MIN_ CONTRAST - WCAG 2.x AAA for body text: what every text floor becomes on a high-contrast palette.
- SELECTION_
STEP - How far a selected row must stand off the window: no hue does the work, so the lightness step has to be visible on its own.
Functions§
- audit
- Every floor
colorsmisses, inFLOORSorder. Empty means the palette keeps every promise an app relies on. Alpha is ignored: every role in the table is opaque. - repair
- Step every foreground that misses a floor out, in OKLCH lightness at its own hue and chroma, until it holds. Grounds never move: the ladder is the theme’s, and a foreground that cannot reach its floor on one ground without losing another (an ink tier on a ladder that straddles it) ends at the extreme that serves the hardest ground. Returns what was missed before the repair.