-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a formatHsl formatter #124
Comments
Hi John, thanks for the kind words and for raising this issue. The formatter API is indeed somewhat incomplete because there were a few decisions to be made and CSS Color Level 4 was still a bit in flux, so we ended up with the bare minimum. The hex variants sorted themselves out due to their inherent representation, and CSS Color Level 4 proposes some changes, among which the fact that sRGB-derived color spaces (including I propose the following serialization rules for
How does it sound? I would gladly take in a PR. |
Yep, makes sense and sounds good to me. Should be able to whip together a PR in the next week or so. Thanks! |
@johno, I have a few free cycles at the moment, if you prefer I can pick this up. |
Feel free to go for it! Been a bit busy lately so would greatly appreciate it. 🙏 |
Added a first pass at the implementation in #130. Currently |
Added an issue on MDN's |
Seeing that |
Thank you very much @danburzo. Your work and library are greatly appreciated! |
Firstly, thanks for the great library!
With our usecase we want to be able to output color strings for hex, rgb, and hsl, though
culori
doesn't currently support hsl. For now I've just written my own stringifier but it feels like this might make sense in the library itself.Proposed solution
Following the existing formatter API, it would accept a color or string and then return hsl/hsla based on whether there's an alpha less than 1.
I'm not super familiar with culori internals, but I see that hex/rgb handle the fixups from within the rgb color mode. Is there a way we can do the same thing with hsl? Is this something you would accept a PR for?
The text was updated successfully, but these errors were encountered: