You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
The Chromatist library aims to pull together implementations of useful color space math, for use both in the browser and in node-based servers. In particular, it currently has implementations of RGB ⇔ CIEXYZ conversions (inchromatist.rgb), CIECAM02 (inchromatist.ciecam), CIELAB (inchromatist.cielab), and HSL and HSV (inchromatist.hsl andchromatist.hsv). There is a simple gamut mapping tool inchromatist.gamut which finds a point of lower chroma but the same hue and lightness within the sRGB gamut using a bisection algorithm.chromatist.matrix3 includes a class for 3 by 3 matrices, andchromatist.mathutils includes a few useful math routines.
This is an early release: the API is likely to change somewhat going forward
Examples
Imagine we want to convert a blue color taken from a website from RGB to CIECAM02 space, take the color with complementary hue, 1.5 times the chroma, and lightness 80, and then convert that result back to RGB.
First we need to set up converters for RGB and CIECAM02. By default, the CIECAM02 converter uses a 'D65' white point, just as sRGB does, so we can leave that parameter implicit.