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
Light/Dark mode switch refactor: toggle on <html>
, use CSS vars
#11
base: main
Are you sure you want to change the base?
Conversation
#dark-mode-off { | ||
display: inline; | ||
thead, tr:nth-child(even) { | ||
background-color: color-mix(in hsl, var(--tertiary) 10%, white); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rough approximation (old vs. new)
background-color: lighten($tertiary, 10%);
background-color: color-mix(in hsl, var(--tertiary) 10%, white);
Relative color syntax isn't supported on FFox yet :( so this feels like an okay workaround.
<html>
, use CSS vars
<html>
, use CSS vars<html>
, use CSS vars
- Repsects prefers-dark by default in JS (no override in SASS) - light/dark-mode class correctly applied to <html>, not <body>
Reviewing in split veiw vs. unified may be easier here, git diff went crazy 😆 Also, everything in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Yeah, I didn't really like how the themes were implemented so this is very helpful.
Removed
@media (prefers-dark...)
, since JS logic already handles this
I actually would prefer not to handle this in JS in case people have disabled it. Could you undo that change or at least make sure it also respects the user's dark mode setting without JS enabled?
Background
Hello!
I tried using the theme, but the way dark/light mode was implemented made it hard to customize variables:
body.dark
, requiring all styles to be duplicated across that andbody
Variables can now be overridden too:
Contents
var(--...)
to allow overriding:root.dark-mode
or:root.light-mode
body
@media (prefers-dark...)
, since JS logic already handles this