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

[Website] Selection Highlight Transparent #118

Open
song-dog opened this issue May 7, 2024 · 1 comment
Open

[Website] Selection Highlight Transparent #118

song-dog opened this issue May 7, 2024 · 1 comment

Comments

@song-dog
Copy link

song-dog commented May 7, 2024

Highlighting on the docs site and help site are currently transparent. The variables being used in the ::selection pseudo element are defined in a scope that it does not have access to, leading to the transparent highlighting. Given that the .theme-dark and .theme-light only define a different alpha value relative to the selection color, one solution may be to define the core components of the colors to the :root and define the alpha values using .has pseudo-classes, as that would give pseudo elements like ::selection access to them.

Ex:

:root {
  --accent-h: 258;
  --accent-s: 88%;
  --accent-l: 66%;
  --text-selection: var(--accent-h), var(--accent-s), var(--accent-l);
}

:root:has(.theme-dark) {
  --text-selection-alpha: 0.25;
}

:root:has(.theme-light) {
  --text-selection-alpha: 0.2;
}

::selection {
  background-color: hsla(var(--text-selection), var(--text-selection-alpha));
}
@joethei
Copy link
Contributor

joethei commented Sep 17, 2024

I am not able to reproduce this, what browser are you using?

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

No branches or pull requests

2 participants