Malachi.UI.TokenGen.Gates (malachi v0.22.7)

View Source

The checks on what the tokens look like, as opposed to how the file is written.

  • Gamut. Every authored color is clipped into sRGB for the consumers that take sRGB (the terminal palette, these checks, the snapshot's srgb8), and a clip that moves it further than $gamut.maxDeltaEOK in OKLab fails: sRGB cannot show what was authored, so the authored value is wrong.
  • Contrast. Every pair in $contrast, in both themes, against its own threshold, on the bytes a screen shows. A pair with alpha on either side is refused rather than composited, because its contrast depends on what it is drawn over.
  • Apart. Every member of each $apart set's these stays at least $apart.minDeltaEOK from every member of its from, in OKLab, in both themes, so a color with one meaning (a cluster's identity) never looks like a color with another (a state).
  • Color vision. Every two members of a $cvd set, in both themes, simulated for a deuteranope, must stay at least $cvd.minDeltaEOK apart in OKLab.
  • Terminal distinctness. Every two tokens in $terminal.distinct land on different 256 color indexes in each theme. When quantisation puts two on one index, the fix is declared by hand in $ansi256; this module never picks a second choice. A declaration equal to what quantisation picks anyway is refused, so the file only carries the exceptions it needs. The sixteen color tier is checked by Malachi.UI.TokenGen.Source, where it is declared.

Summary

Functions

Runs every gate. An empty list means the tokens pass.

Functions

check(model)

@spec check(Malachi.UI.TokenGen.Model.t()) :: [String.t()]

Runs every gate. An empty list means the tokens pass.