-
Notifications
You must be signed in to change notification settings - Fork 155
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
Dark mode for Qt application #2417
Conversation
9adc50d
to
9cff1d2
Compare
@astrofrog Thanks for pointing that out! I don't see the same issues on Ubuntu so I hadn't noticed. I'll try and reproduce on my Mac. The viewer theme should change to WoB if the app theme is set to Dark and the user had been using BoW (and vice versa) - I'll check if there's a bug there. I like the idea about adding an option to keep the viewer theme in sync with the application theme, will add that in. |
I wonder if there are existing packages such as https://pyqtdarktheme.readthedocs.io that could help if it gets too tricky to get to work on all platforms? |
@astrofrog so it looks like these issues come from the part of the application that are drawn directly by the system window manager. On MacOS, if I have the general appearance set to Light, I see the issues that you pointed out: But with the system appearance set to Dark: I'll look into what we can do about that. I'll look at pyqtdarktheme as well - their docs mention the ability to sync with the OS theming, so maybe they have a way to handle these sort of issues. |
@astrofrog I made a very basic setup with From looking at how they've done things, I think what's needed to fix these issues is to modify the application stylesheet as well. |
As noted in #2430, I will be splitting out Qt-related code into a separate repository - however that repository will have the same history as the present one here so it should be easy to move over the pull request to that repository (I can help if needed). Sorry for the disruption! |
@Carifio24 - I'm going to close this since it isn't possible to automatically transfer PRs to different repos, but feel free to re-open on the glue-qt repo, as it would be great to have that there! |
@astrofrog Sounds good, I'll move this over (and try to get back around to finishing this up). |
This PR contains an implementation of dark mode for the Qt app, suggested in #2332 and endorsed by @aagoodman. This primarily consists of adding the ability to change the application's
QPalette
, but there are a few elements that require some specific handling. In the UI, changing the application theme is done via the Preferences dialog. Some things to note:pygments
library for syntax highlighting. There are only 3 darkpygment
styles that meet the WCAG contrast minimum - of these, I decided to go withrrt
.There are still a couple of minor issues:
Any thoughts on either the implementation or the dark mode styling are welcome!