@pbroom/color-kitContrast

ContrastPrecision

Channel precision for contrast metrics.

typeimport type { ContrastPrecision } from '@pbroom/color-kit';metrics.ts:25
type ContrastPrecision = 'exact' | '8bit';
  • 'exact' (default): unrounded channel values, so the result is a continuous function of the color (and agrees with colorjs.io for in-gamut colors).
  • '8bit': quantize the gamma-encoded channels to 8 bits first, the way hex-based tools (WebAIM, browser devtools) measure. For the sRGB gamut this reproduces color-kit 0.1 results bit for bit.