Open toastal opened 3 years ago
-- | - Colors outside the sRGB gamut which cannot be displayed on a typical
-- | computer screen can not be represented by Color.
This ain't true anymore. DCI-P3 is quite common on phones and increasingly in monitors and laptops (such as my own). CSS4 opened up to color gamuts beyond sRGB https://www.w3.org/TR/css-color-4/#icc-colors. By choosing a device-independent color representation without gamma correction or color space clipping, device-dependent colors could be derived.
I would then suggest doing something like using CIELAB which W3 shows as the underlying color representation and convert to sRGB, P3, et.al. when needed. Alternatively LCH is another reasonable default.
Fully agreed. This library already supports CIELAB and LCh... but it's unnecessarily limited to the sRGB gamut.
This would likely be a very breaking change,
Right. Unfortunately, the Color
datatype publicly exposes the default representation. I could also imagine that we would run into a few floating point inaccuracy problems when switching to another default representation.
Note1: I'm not actively using this library anymore so I'm almost certainly not going to work on this myself. Note2: Since writing this library, I have started another project (in Rust) that 'suffers' from a similar problem (see e.g. https://github.com/sharkdp/pastel/issues/108)
Gotcha. Perhaps if I have some cycles, I'll come back and look at this. I only understand this at a higher level (photography), but not the math behind it (though it'd be good to learn).
I'm currently looking library for a task (related to the PR) -- and luckily the task will 100% be within sRGB.
btw, I have restored deleted schemes and scales https://github.com/purescript-open-community/purescript-open-colors-scales-and-schemes
This ain't true anymore. DCI-P3 is quite common on phones and increasingly in monitors and laptops (such as my own). CSS4 opened up to color gamuts beyond sRGB https://www.w3.org/TR/css-color-4/#icc-colors. By choosing a device-independent color representation without gamma correction or color space clipping, device-dependent colors could be derived.
I would then suggest doing something like using CIELAB which W3 shows as the underlying color representation and convert to sRGB, P3, et.al. when needed. Alternatively LCH is another reasonable default.
This would likely be a very breaking change, but I think is 100% necessary as it frees the library from color spaces. As it is, this is not a general-purpose library if colors are limited to sRGB.
If I'm missing something, please inform me.