Skip to content
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

Rango fails to display hints when page uses some new colors from CSS Color Module Level 4 #251

Open
1 of 2 tasks
david-tejada opened this issue Dec 4, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@david-tejada
Copy link
Owner

david-tejada commented Dec 4, 2023

Up until recently, retrieving the color or the background color of an element using getComputedStyle always returned a string starting with rgb or rgba. With new color spaces added to CSS Color Module Level 4 that is no longer the case. Here are some examples of color strings return from getComputedStyle:

  • oklch(0.7 0.1 248)
  • lch(70 0.1 248)
  • lab(70 10 -40)
  • oklab(0.7 10 -40)

Here is an example of a page that uses these new colors where the hints aren't displayed: daisyUI — Tailwind CSS Components ( version 4 update is here )

The color library that I am currently using can't handle any of those colors. The colord library seems to be more complete. Although it still can't handle oklch or oklab there seems to be ongoing work to add them.

The solution for this issue would be two steps:

  • Handle errors when passing colors. Default to hints with dark text over white background.
  • Switch to colord and rewrite the color logic to be able to handle these new color spaces.
@david-tejada david-tejada added the bug Something isn't working label Dec 4, 2023
@david-tejada
Copy link
Owner Author

This library seems interesting too: https://colorjs.io/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant