Feature request: Can we get HSL color parsing?
See original GitHub issueI use hsl(…)
colors extensively in my theming but doing so means that they are currently not properly calculated as being “dark”.
Expected Behavior
I would expect that if I have a global.colors.text
of { light: "black", dark: "white" }
and a primary button background color of hsl(100, 3%, 18%)
, that it would have white text.
Actual Behavior
It has black text because there is currently no way for getRGBArray
to parse it, so that function just returns the same value it got – the string "hsl(100, 3%, 34%)"
– which is not what the colorIsDark
function is expecting to deal with.
URL, screen shot, or Codepen exhibiting the issue
Steps to Reproduce
Use hsl(…)
based colors in your theme, particularly for button colors.
Your Environment
- Grommet version: 2.6.5
- Browser Name and version: irrelevant
- Operating System and version (desktop or mobile): irrelevant
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
[Feature Request] Allow RGB and HSL string specification in ...
Problem to solve HSL provides a natural encoding of colours that is easily readable. Hex requires a great deal of experience to read ......
Read more >OKLCH in CSS: why we moved from RGB and HSL
The main problem with HSL is that it has a cylindrical color space. Every hue has the same amount of saturation ( 0—100%...
Read more >What is the most efficient way to parse a CSS color in ...
function parseColor(input) { var m;. Obviously, the numeric values will be easier to parse than names. So we do those first.
Read more >chroma.js api docs!
You can construct colors from different color spaces by passing the name of color space as the last argument. Here we define the...
Read more >CSS Color Module Level 4 - W3C
In certain cases, a color can have one or more missing color components . In this specification, this happens automatically due to hue-based ......
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
Awesome! Thank you, @ericsoderberghp! 😄
@ericsoderberghp @alansouzati would love your input here as well.