-
Notifications
You must be signed in to change notification settings - Fork 98
feat: add dark mode support via prefers-color-scheme #676
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
base: main
Are you sure you want to change the base?
Conversation
2d3bac6 to
3d68642
Compare
Add automatic dark mode support that respects operating system preferences using the `@media (prefers-color-scheme: dark)` CSS media query. Changes: - verso-vars.css: Add new CSS custom properties for backgrounds, borders, links, shadows, and message colors with dark mode variants - code.css: Update API docs styling to use CSS variables - search-box.css/search-highlight.css: Update search UI to use CSS variables - Style.lean: Update manual page styling to use CSS variables The color scheme is harmonized with lean-lang.org: - Light: #ffffff background, leanprover#333 text, #386ee0 links - Dark: #1e1e1e background, #eee text, #3b94ff links Closes leanprover#641
3d68642 to
be4f660
Compare
|
This sounds great, and looks good based on the diffs! Given that you've got a checklist, I'll hold off on reviewing it until you indicate that you're ready. WRT testing the dark mode toggle, we do have Playwright tests for some features already, which seems like a natural place to put these tests. |
|
Thanks for the feedback! I've fixed the prettier formatting issue that was causing CI to fail. The core dark mode via
For testing the dark mode toggle, I can add Playwright tests. Should I:
|
|
Sorry for the delay in replying. Winter holidays are now over! I think that Playwright tests for the toggle button are important, because local storage won't be "automatically" tested in any reasonable way by most daily use of the sites, and issues would affect first-time readers disproportionately. I think the risk of regressions on the visual aspects is relatively small, though. So number 1 :-) Thanks again, this is really a wonderful improvement! |
|
|
||
| /** Background colors **/ | ||
| --verso-background-color: #ffffff; | ||
| --verso-surface-color: #f9fbfd; |
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.
A comment here explaining the "surface" terminology would be helpful.
| } | ||
|
|
||
| /** Dark mode - respects OS preference **/ | ||
| @media (prefers-color-scheme: dark) { |
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.
I've noticed that Verso outputs that aren't designed for color switching are caught by this. How can we make it opt-in for outputs/backends that want to support system color theme specification? Maybe they should need to add data-verso-dark-mode to something?


Summary
Add automatic dark mode support that respects operating system preferences using the
@media (prefers-color-scheme: dark)CSS media query.The color scheme is harmonized with lean-lang.org as requested:
#ffffffbackground,#333text,#386ee0links,#f9fbfdsurface#1e1e1ebackground,#eeetext,#3b94fflinks,#181818surfaceTest plan
lake build)Closes #641