Matrix3
Full double-precision conversion matrices shared by the conversion and gamut modules.
import type { Matrix3 } from '@pbroom/color-kit';matrices.ts:18type Matrix3 = readonly [readonly [number, number, number], readonly [number, number, number], readonly [number, number, number]];These follow CSS Color 4 / colorjs.io: sRGB and Display P3 matrices are derived directly from the primaries and D65 white chromaticities, and the OKLab matrices are the "recalculated for consistent reference white" versions (github.com/w3c/csswg-drafts/issues/6642). The linear-sRGB <-> LMS and linear-P3 <-> LMS matrices are the products XYZtoLMS · RGBtoXYZ / XYZtoRGB · LMStoXYZ, evaluated in float64.
The previous 10-significant-digit values (Ottosson's original blog post and an 8-digit-derived sRGB -> P3 matrix) disagreed with the reference by up to ~2e-7 per matrix entry, which put white at L = 0.99999999, C = 3.7e-8 and produced up to ~3.4e-6 error in gamma-encoded Display P3 channels.