Color (github) is a comprehensive color library. Now at version 0.2 but much more developed than the long ago 0.1. In fact I expect to move this to 1.0 release quite quickly since I consider its API stable. Feedback might change that though! ![]()
Features
-
20+ color space structs including
Color.SRGB,Color.AdobeRGB,Color.RGB(linear, in any of 24 named working spaces),Color.Lab,Color.LCHab,Color.Luv,Color.LCHuv,Color.XYZ,Color.XYY,Color.Oklab,Color.Oklch,Color.HSLuv,Color.HPLuv,Color.Hsl,Color.Hsv,Color.CMYK,Color.YCbCr,Color.JzAzBz,Color.ICtCp,Color.IPT,Color.CAM16UCS. -
Top-level conversion API.
Color.new/2andColor.convert/2,3,4accept structs, hex strings, CSS named colors, atoms, or bare lists of numbers (with strict per-space validation) and convert between any pair of supported spaces.Color.convert_many/2,3,4is the batch equivalent. Alpha is preserved across every path. -
Chromatic adaptation with six methods (
:bradford,:xyz_scaling,:von_kries,:sharp,:cmccat2000,:cat02).Color.convert/3,4auto-adapts the source illuminant when the target requires a fixed reference white. -
ICC rendering intents wired into
Color.convert/3,4::relative_colorimetric(default),:absolute_colorimetric,:perceptual,:saturation. Optional black-point compensation viabpc: true. -
ICC matrix-profile reader (
Color.ICC.Profile) for ICC v2 / v4 RGB→XYZ profiles, withcurvLUT andparaparametric tone response curves. Loads profiles likesRGB IEC61966-2.1.icc,Display P3.icc,AdobeRGB1998.icc, and most camera and scanner profiles. -
Color difference (ΔE). CIE76, CIE94, CIEDE2000 (verified against the Sharma 2005 test data), and CMC l:c.
-
Contrast. WCAG 2.x relative luminance and contrast ratio, APCA W3 0.1.9 (
L_c), andpick_contrasting/2for accessibility helpers. -
Mixing and gradients.
Color.Mix.mix/4interpolates in any supported space (default Oklab) with CSS Color 4 hue-interpolation modes (:shorter,:longer,:increasing,:decreasing).Color.Mix.gradient/4produces evenly spaced gradients. -
Gamut checking and mapping.
Color.Gamut.in_gamut?/2andColor.Gamut.to_gamut/3with the CSS Color 4 Oklch binary-search algorithm or simple RGB clip. -
Color harmonies. Complementary, analogous, triadic, tetradic, and split-complementary in any cylindrical space (default Oklch).
-
Color temperature. CCT ↔ chromaticity, Planckian locus and CIE daylight locus.
-
CSS Color Module Level 4 / 5. Full parser and serialiser for hex, named colors,
rgb()/rgba(),hsl()/hsla(),hwb(),lab(),lch(),oklab(),oklch(),color(srgb|display-p3|rec2020|…),device-cmyk(),color-mix(), relative color syntax,nonekeyword, andcalc()expressions. -
~COLORsigil for compile-time color literals in any supported space. -
Spectral pipeline.
Color.SpectralandColor.Spectral.Tablesprovide the CIE 1931 2° and CIE 1964 10° standard observer CMFs, the D65 / D50 / A / E illuminant SPDs, emissive and reflective integration to XYZ, and a metamerism helper. -
Blend modes. All 16 CSS Compositing Level 1 modes (
:multiply,:screen,:overlay,:darken,:lighten,:color_dodge,:color_burn,:hard_light,:soft_light,:difference,:exclusion,:hue,:saturation,:color,:luminosity,:normal). -
Transfer functions. sRGB, gamma 2.2 / 1.8, L*, BT.709, BT.2020, PQ (SMPTE ST 2084), HLG, Adobe RGB γ.
A proper Color module has been largely the last sticking point before I could consider moving image to version 1.0. With this update to color I will soon be able to move image to 1.0 too.






















