CSS color parsing and contrast math.
Colors are {r, g, b} tuples of gamma-encoded sRGB in 0.0..1.0. Out-of-gamut
oklch values are clipped per channel, which is what browsers do too.
Summary
Functions
APCA lightness contrast (Lc), apca-w3 0.0.98G-4g. Order matters: text first. Positive is dark text on light, negative is light text on dark.
WCAG 2.x contrast ratio, 1.0..21.0. Order doesn't matter.
Types
Functions
APCA lightness contrast (Lc), apca-w3 0.0.98G-4g. Order matters: text first. Positive is dark text on light, negative is light text on dark.
WCAG 2.x contrast ratio, 1.0..21.0. Order doesn't matter.