Class ThemeAudit

java.lang.Object
limn.themeeditor.ThemeAudit

public final class ThemeAudit extends Object
What is wrong with a palette, measured rather than judged.

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.

  • Method Details

    • of

      public static List<ThemeAudit.Finding> of(Theme theme)
      Every bar theme misses, 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

      public static ThemeAudit.Level worst(List<ThemeAudit.Finding> findings)
      Returns:
      the worst level in findings, or null when there are none