 
Earlier this year I had to investigate perception of colour attributes for some of my projects. There exists a long history of colour models that try to approximate perception, each with its own shortcomings and complexities. For a decent modern colour space suitable for image processing and with accompanying C code, OkLab can be recommended (based on CAM16 and to some extend IPT).
But for my needs, I ended up implementing a more recently released model: ZCAM, a colour appearance model based on a high dynamic range uniform colour space. ZCAM is a new colour appearance model published in 2020, it is based on the Jzazbz colour space, attempts to improve on the existing colour appearance models and provides a computable inverse. This makes it suitable for forward and backwards conversions between practical colour spaces like sRGB and the ZCAM colour appearance model parameters for image processing and with some effort gamut clipping.
The code is hosted on GitHub: zcam-js
And it is available as an npm module: zcam-js
Using the test cases provided by the ZCAM paper authors in Supplementary document for ZCAM, a psychophysical model for colour appearance prediction, a test battery could be constructed to validate forward and backward transforms of various combinations of parameters. A number of challenges were encountered while validating the provided test results:
- The ZCAM authors apparently used a specifically rounded variant of the D65 white point coefficients, as outlined in luxpy issue #20. 
- The setup parameters - La(Luminance of the adapting field in cd/m²) and- Yb(relative luminance of the background) from test case (3) are obviously off, re-using the surround parameters from tests (1) or (2) produces the expected results.
- The hue angle - hzfrom test (5) needs adjustment to fit into- 0…360.
- Given the ZCAM paper formula (18) for - Kz(blackness) and the ZCAM supplement test values for- Jz(lightness) and- Cz(chroma), the fractional digits of the- Kztest results are simply not plausible.
The implementation now supports transforms from the XYZ colour space
(or sRGB) to the ZCAM parameters Jz, Qz,
Cz, Sz, Mz, Vz,
Wz, Kz, hz, Hz
(described below). Colour space inputs under white points other than CIE
D65 are adapted using CAT02 as
demanded by the ZCAM paper.
And it supports back transforms into XYZ/sRGB/etc colour spaces
(while inverting the white point adaption if needed) from three of the
ZCAM colour appearance model parameters: one of lightness
Jz or brightness Qz, one of chroma
Cz or saturation Sz or colourfulness
Mz or vividness Vz or whiteness
Wz or blackness Kz, and one of hue angle
hz or hue composition Hz.
Also, the code now contains functions to find the chroma & lightness cusps for a given hue and the chroma maximum for a given hue and brightness within a gamut, needed for gamut clipping.
The following video shows the sRGB Chroma/Lightness cusps across all hues in ZCAM, the chroma maximum for a specific lightness (Y axis) corresponds to the rightmost pixel that is still visible (i.e. inside the gamut): ZCAM (Cz, Jz) per Hue