-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use light icons on dark themes for wx and gtk, too. #17459
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
Conversation
# See wx.Colour.GetLuminance. | ||
bg_lum = (.299 * bg.red + .587 * bg.green + .114 * bg.blue) / 255 | ||
fg_lum = (.299 * fg.red + .587 * fg.green + .114 * fg.blue) / 255 | ||
dark = fg_lum - bg_lum > .2 |
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.
Why calculate this differently from GTK?
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.
This is copypasted from the implementation of wx's IsUsingDarkBackground (which is not available on older wx), so at least it's internally consistent across wx versions.
Also I was not able to figure out how to get the text color on gtk...
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 think there's a better way to do it on GTK, but it would be a much more substantial re-write.
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'm not actually a gtk expert at all (tbh I find its docs much harder to follow than wx, which I'm not that familiar with either (I (used to) use qt fairly regularly) but find much easier to follow), so I'll leave it up to you whether we want the "complicated" solution here.
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.
OK, I think I've figured it out and it's actually not as complicated as I thought, but it's a bit of a hack right now. I'll try and figure out how to be less hacky and open a PR.
rebased |
So to be clear on the problem here, in dark mode, the buttons in GTK do not reflect their state. So if back/forward are disabled, they look the same as the rest of the buttons. When My original thought was to switch
Currently, every backend uses |
Symlink them? The number of people using matplotlib + gtk on windows and without the ability to create symlinks is likely, uh, limited. |
Wasn't sure if that might cause trouble in wheels? Since they're zips, do they preserve them? |
From a very quick check, looks like the symlink just gets replaced by a regular file in the wheel, but that's fine? That just means that whoever installs from a wheel will get a copy instead of a symlink, but that's fine? |
GTK handling must be removed because that's handled now via #17539. |
done |
This can be tried e.g. by setting `GTK_THEME` to `Adwaita:dark`. I made the `_icon` API "consistent" across qt and wx, too.
These can be tried e.g. by setting
GTK_THEME
toAdwaita:dark
.I couldn't find how to get the foreground color in GTK3 so the check for
dark themes is just looking at the luminance of the background, and the
icon color is set to white. (Better approaches welcome...)
I made the
_icon
API "consistent" across qt, wx, and gtk.(Qt already supports this, and I don't think Tk supports this kind of theming out of the box anyways.)
before:


after:
PR Summary
PR Checklist