Add a formatHsl formatter
See original GitHub issueFirstly, 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.
culori.formatHsl('tomato')
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?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
Free Online HTML Formatter - FreeFormatter.com
This free online HTML formatter and validator lets you chose your indentation level and also lets you export to file.
Read more >HTML Formatter
Free online tool to format an ugly HTML code, making it readable and pretty, with the proper indentation. Autodetect HTML XML CSS JavaScript...
Read more >Online HTML formatter, HTML beautifier - SmallDev.tools
HTML Beautifier /formatter is an online Tool to easily beautify your HTML code. Paste any minified codes or unindented codes and you'll get...
Read more >HTML Text Formatting - W3Schools
HTML Formatting Elements · <b> - Bold text · <strong> - Important text · <i> - Italic text · <em> - Emphasized text...
Read more >HTML Viewer - Code Beautify
Online HTML Viewer, HTML Beautifier, HTML Formatter, HTML Editor to Test output - Convert HTML Strings to a Friendly Readable Format, Beautify.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Added a first pass at the implementation in #130. Currently
h
,s
andl
are rounded to the nearest integer. Bothrgb()
andhsl()
color notations explicitly accept float values in CSS Color 4 but I’m not sure what the support story is for floats in thehsl()
notation. If it’s as patchy as forrgb()
, then I think it would be best to round the values inhsl
as well. Otherwise, 2-digit precision floats sound better to me. Maybe there are some Web Platform Tests about this specifically…Thank you very much @danburzo. Your work and library are greatly appreciated!