Class ThemeAudit
A palette is easy to build and hard to build legibly: every tone is chosen against a white page in an editor and then lands on a surface it was never compared to. This runs the comparisons (every ink against every surface it can appear on, every elevation step, and the two distinctness rules that a contrast ratio alone would call fine), so an editor can say which pair is the problem instead of leaving it to be found in a screenshot later.
The bars are WCAG 2.1. 4.5:1 for body text, 3:1 for large text and for
meaningful non-text such as an accent-filled indicator or a focus ring. Disabled text is
exempt from the guideline and is reported at ThemeAudit.Level.INFO for that reason:
a control that is switched off is allowed to be quiet, and an editor that flagged it as
an error would be teaching the wrong lesson.
Elevation is measured in CIE L*, not in contrast ratio; see
Color.lightness() for why the ratio is unusable for it at the light end.
One tone is measured alone. The modal veil is a colour with an alpha painted
over whatever the application happens to be showing, so there is nothing in the palette
to measure it against and its finding names no second tone. The guideline has no bar for
a veil at all, which is why both ends of that rule are a ThemeAudit.Level.WARNING and
neither is an error.
Pure computation over a value: no widgets, no UI thread, no state.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhich side of its bar a measurement came out on.static final recordOne measurement that missed its bar.static enumHow much a finding matters.static enumWhich scale a finding was measured on, and how a number on it is written. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<ThemeAudit.Finding> Every barthememisses, worst first and then in token order.static ThemeAudit.Levelworst(List<ThemeAudit.Finding> findings)
-
Method Details
-
of
Every barthememisses, worst first and then in token order.An empty list is not a promise that a palette is beautiful, only that nothing in it is measurably illegible. Taste is still the author's.
-
worst
- Returns:
- the worst level in
findings, ornullwhen there are none
-