-
Notifications
You must be signed in to change notification settings - Fork 17
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
Added Dark Mode support to option tables #253
Conversation
@SebastianGode thanks for your contribution! I'll take a closer look soon. Can you add a changelog fragment? Thanks. |
I've added a fragment. I'm not sure if it's correct, but I tried :) |
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.
There are two big problems with this PR:
- This is only setting some colors. In case the theme itself does not have a dark mode, the tables are partially unreadable:
- In low-width modes, it really looks bad since most colors are not adjusted:
Maybe it's better to make dark mode support configurable, so you can enable it if the underlying theme also supports it, and disable it if not. That would fix 1. For 2., some more CSS would be needed.
changelogs/fragments/253-darkmode-support-to-option-tables.yaml
Outdated
Show resolved
Hide resolved
I started working around these problems in #254. That PR makes it easy to add new color schemes (this PR would translate into creating a copy of the default scheme, adding a media query with redefinitions of the colors for dark mode, and allowing to select that color scheme in the config). That way colors can be selected (or even defined) by the extension's user (who also has control over which theme and other extensions are used). |
I went ahead and merged #254 so you aren't blocked on that PR. Note that I changed the way the node.js dependencies (sass and postcss) are installed, now you have to run |
Thanks for the work @felixfontein ! |
Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein I now think that I have fixed the tables in the narrow view. And adding the option to select different themes was awesome! That works like magic now :) |
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
@SebastianGode thanks a lot for your contribution! |
@felixfontein Would it be possible to get a new Release to PyPi? 😃 |
Yes, maybe later today or tomorrow. I want to add a small change before releasing. |
I noticed that Antsibull didn't respect the
prefers-color-scheme
browser or system setting of the users which access the documentation website.This will result in completely unreadable tables for Sphinx-Themes which already include support for such user settings.
To fix this I added some css code to change the colors accordingly for dark mode. The colors are chosen to get a contrast ration >7 and to pass Google's usability rating with an AAA.
If you have any suggestions feel free to mention them.
Before
After
Tip: You can quickly switch the Browser View to Dark-Mode or Light-Mode by using the Developer Options:
Just don't use the auomatic conversion from the Browser as that will replace all CSS.