Skip to content

Set the GTK background color to white. #19410

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

Merged
merged 1 commit into from
Feb 11, 2021
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jan 31, 2021

This is consistent with the other backends (although this seems to be
broken on wx too), which allows semi-transparent figures to be rendered
against a consistent background (this can be checked e.g. with
figure(facecolor=(0, 0, 0, 0)) or figure(facecolor=(1, 1, 1, .5))),
which would previously be rendered differently on gtk3 when using a dark
theme.

While override_background_color is marked as deprecated on gtk3, the
alternative seems to involve a bunch of CSS, and it seems unlikely to
ever be removed now that gtk development has switched to gtk4...

xref #9698.

PR Summary

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@QuLogic
Copy link
Member

QuLogic commented Feb 1, 2021

There should be a way to do this without deprecated API, though GTK follows semver, so it would never have been removed until 4.

@QuLogic
Copy link
Member

QuLogic commented Feb 1, 2021

See alternative in #19424.

This is consistent with the other backends (although this seems to be
broken on wx too), which allows semi-transparent figures to be rendered
against a consistent background (this can be checked e.g. with
`figure(facecolor=(0, 0, 0, 0))` or `figure(facecolor=(1, 1, 1, .5))`),
which would previously be rendered differently on gtk3 when using a dark
theme.
@anntzer
Copy link
Contributor Author

anntzer commented Feb 10, 2021

I figured out how to do it with non-deprecated APIs...

@timhoffm timhoffm added this to the v3.4.0 milestone Feb 11, 2021
@timhoffm timhoffm merged commit fbe82bb into matplotlib:master Feb 11, 2021
@anntzer anntzer deleted the gtkbg branch February 11, 2021 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants