Open saadeghi opened 1 year ago
I can at least comment and provide some insight. As things go the intermediary format internal to colord
is RGBA. Even using the various other format methods everything passes through RGBA internally and won't maintain precision for anything beyond the sRGB color space. There are also rounding / precision aspects elsewhere in the code.
I really like the colord
API and structure, but it does lack in precise control.
For precise control colorjs
/ https://colorjs.io/ is a fair candidate though the API and general structure is less than to be desired.
In an ideal world a solution that combines the API structure of colord
w/ the data & format handling of colorjs
would be ideal.
@saadeghi; Just for curiosities sake since you mentioned Svelte I am using a slightly modified version of colord
(correct a precision aspect) for a high powered Svelte color picker component; (initial dev snapshot video). Also uses container queries and I implemented the fixes / support in Svelte 3.58.0
to make that so.
You can see the code for that here which shows that colord
is adequate for a sRGB color space / picker; still required some work arounds. Internally the picker works w/ HSV. Code here:
https://github.com/typhonjs-fvtt-lib/svelte-standard/tree/main/src/component/standard/color/picker-colord
When I give an LCH color to the function, I get a different color in the output.
For example this is my color:
lch(58.68% 98.6 352.06)
(which is a valid P3 color)And using
toLchString
I expect the same values:But the result is:
Here's a live example: https://svelte.dev/repl/14e79bf716994c98956d6b27ae0065a5?version=3.58.0