Open limzykenneth opened 4 weeks ago
Hey @limzykenneth thanks for considering this library!
Some notes:
@texel/color
, unlike other libraries like Colorjs and culori, is different in that it doesn't try to match CSS spec exactly (but takes inspiration from it in terms of color space choices and conversion matrices). This will allow the library to remain fairly stable for many years, even if CSS Color spec continues to expand in complexity. So if matching CSS spec is really important, it might not be worth using @texel/color
for anything except very hot code paths (such as per-pixel manipulation).@texel/color
(although not well documented), and circular interpolation should be easy to add (already present in the source, but commented out), so the next question becomes what other features would be important for color interpolation?@texel/color
, even for example css-color parser works fine for some spaces right now, but it does not match 100% of the color string spec either. Things like calc()
and relative colors will be tedious to parse.I'll see what I can do about adding additional documentation and examples for your needs.
I've now added:
test/spaces
folder@texel/color
)So far I haven't added these as core parts of the library; happy to be convinced if users think CIELab/Luv and HSL/HSV/etc need to be core features.
Hi, this library was pointed out to me while I am looking into rewriting the color modules of p5.js which the initial plan is to use color.js as a backing dependency, however what you have implemented here is really exciting and I am looking into using this instead of color.js.
There are several things that we need for p5.js that are not currently supported and I would like to know what your thoughts are in terms of implementing them in @texel/color, whether they are not planned to be supported or something that @texel/color would like to have. I may have some misunderstanding around colors so do point out if anything don't make sense here.
lab()
andlch()
functions are both in CIE color space which we like to support if possible. If the intention is to not support CIE colors at all then it leads to the next item.rgb(0, 128, 255)
andrgb(0 128 255)
are valid and supported CSS strings but only the former works, color words such asgreen
also does not work, alpha deserialization also does not work; for serialization,hsl
seems to be serialized into acolor(okhsl)
string instead which have less support in CSS than the nativehsl()
function.Depending on what the plan for this project is, p5.js can possibly help with providing some implementation support to implement some of the above since if we were to use @texel/color as the backing dependency of our color module, we will need to implement them anyway so I feel it's much better to do it here instead.
Really look forward to see what comes for the rest of the project!