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

Add better rgb support #570

Merged
merged 4 commits into from
Oct 17, 2024
Merged

Add better rgb support #570

merged 4 commits into from
Oct 17, 2024

Conversation

s-cork
Copy link
Collaborator

@s-cork s-cork commented Oct 17, 2024

Current failings with _get_rgb:

  • we don't support css vars
  • we don't support known colors e.g. red
  • we have a couple of bugs with misuse of commas in rgb css

Approach in this PR:

  • add a hidden dom element to page body
  • This hidden dom element is wrapped in a hidden container with an obscure color
  • set the style of the hidden element
  • use window.getComputedStyle which returns rgb(r, g, b) or rgba(r, g, b, a)
  • convert this color to the required space separated values that can then be added to our css vars

Also fixes the tab color is not being applied correctly to the inactive tabs

close #568

@meatballs meatballs merged commit cdb7cb2 into main Oct 17, 2024
3 checks passed
@meatballs meatballs deleted the tab-colors branch October 17, 2024 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't use css variables as foreground value for Tabs
2 participants