Closed Carifio24 closed 2 months ago
Looking good so far! On my system (Mac with Qt 6.4) I can't read the text on combo boxes and tabs when they are not selected:
The main application toolbar also doesn't look quite right and the text is hard/impossible to read:
I had to also explicitly change the viewers so that they are white on black instead of black on white - is that normal? Should we perhaps change that automatically when selecting dark? Maybe one of the options for the viewer colors should be 'theme default' which then just matches light or dark as needed.
@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 pyqtdarktheme
here - it works quite well, but the flat theme they use is (at least to my eyes) a pretty stark difference from how glue currently looks.
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 https://github.com/glue-viz/glue/issues/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!