Skip to main content

Module contrast

Module contrast 

Source
Expand description

How far apart two colours are, in the two ways the colour roles are held to: contrast for an ink on a fill, and separation for a fill that has to be seen on another.

The design system tables are tested against these, an application’s palette is checked against them, and the Renderer chooses an ink with the same arithmetic.

Constants§

DIFF_ROLES
Each diff ink with its line background and its word background.
MIN_SEPARATION
How far apart, summed over three eight bit channels, two fills have to be before one can be seen on the other. The same figure the system tables are tested against.
SYNTAX_ROLES
The fifteen syntax inks.

Functions§

apart
Summed channel distance in eight bit terms.
contrast
The WCAG contrast ratio of two opaque colours, from 1 to 21.
luminance
Relative luminance, as WCAG defines it.