question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Can we get HSL color parsing?

See original GitHub issue

I 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

Codesandbox

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:closed
  • Created 4 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dallascommented, Apr 29, 2019

Awesome! Thank you, @ericsoderberghp! 😄

0reactions
oorestisimecommented, Apr 20, 2019

@ericsoderberghp @alansouzati would love your input here as well.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found