Closed ATell-SoundTheory closed 2 months ago
Color conversions are the domain of Colors.jl, not ColorTypes.jl. I once tried to expand on chromatic adaptation. However, I decided it was better to have a separate package for color management. cf. https://github.com/JuliaGraphics/Colors.jl/pull/340
Using the CAT02 conversion matrix used for converting CIE 1931 XYZ to LMS is not really meaningful without the required post processing steps (see the wikipedia article you linked). The transform also assumes a standard illuminant E whitepoint and not a D65 one, which I think you are implicitly using. Adding this to the documentation would also be helpful.
As a result, converting spectral color matching results to LMS results in negative color coefficients, which is impossible because these values are defined as non-negative receptor stimuli.
In general, it would be wise to mark the XYZ type with the CIE standard that is used, because this standard also determines the proper way to convert to LMS or which color matching function from Colors.jl is the fitting one.
Therefore, at the moment, there is no correct native workflow for converting spectral colors to XYZ and to LMS.