Title: [Bug]: Qt5Agg icon remains black in dark mode · Issue #30564 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Qt5Agg icon remains black in dark mode · Issue #30564 · matplotlib/matplotlib
X Title: [Bug]: Qt5Agg icon remains black in dark mode · Issue #30564 · matplotlib/matplotlib
Description: Bug summary I noticed in a screenshot from another PR that out of the six backends displayed, only the Qt5Agg icon fails to adapt to dark mode. It remains black and blends in with the background, making it difficult to distinguish. #3055...
Open Graph Description: Bug summary I noticed in a screenshot from another PR that out of the six backends displayed, only the Qt5Agg icon fails to adapt to dark mode. It remains black and blends in with the background, m...
X Description: Bug summary I noticed in a screenshot from another PR that out of the six backends displayed, only the Qt5Agg icon fails to adapt to dark mode. It remains black and blends in with the background, m...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/30564
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Qt5Agg icon remains black in dark mode","articleBody":"### Bug summary\n\nI noticed in a screenshot from another PR that out of the six backends displayed, only the Qt5Agg icon fails to adapt to dark mode. It remains black and blends in with the background, making it difficult to distinguish.\n\nhttps://github.com/matplotlib/matplotlib/pull/30554#issuecomment-3291208454\n\n\u003cimg width=\"2040\" height=\"1200\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/391c2799-cba6-4cd3-92a7-af9d3b9f9e07\" /\u003e\n\n\nI believe the issue lies in the following code:\n\n```python\nif self.palette().color(self.backgroundRole()).value() \u003c 128:\n icon_color = self.palette().color(self.foregroundRole())\n mask = pm.createMaskFromColor(\n QtGui.QColor('black'),\n QtCore.Qt.MaskMode.MaskOutColor)\n pm.fill(icon_color)\n pm.setMask(mask)\n```\nIt appears the icon is rendered as black regardless of whether the `if` condition is met. This is likely caused by the line `mask = pm.createMaskFromColor(QtGui.QColor('black'), QtCore.Qt.MaskMode.MaskOutColor).`\n\n### Code for reproduction\n\n```Python\nimport matplotlib\nimport matplotlib.pyplot as plt\nmatplotlib.use('Qt5Agg')\nfig, ax = plt.subplots(subplot_kw = {\"projection\" : \"3d\"})\nax.bar3d([1, 1, 2, 2], [1, 2, 1, 2], 0, 1, 1, [2, 3, 1, 4], axlim_clip=True)\nplt.show()\n```\n\n### Actual outcome\n\n\u003cimg width=\"647\" height=\"557\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/f8d2b7fe-9ff7-451d-9789-5c985c6e70fe\" /\u003e\n\n### Expected outcome\n\n\u003cimg width=\"642\" height=\"552\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/59d3274b-f352-41b1-a312-59649aaf7cdc\" /\u003e\n\n### Additional information\n\n_No response_\n\n### Operating system\n\nMacOS\n\n### Matplotlib Version\n\n3.11.0\n\n### Matplotlib Backend\n\nQt5Agg\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nNone","author":{"url":"https://github.com/LangQi99","@type":"Person","name":"LangQi99"},"datePublished":"2025-09-16T03:00:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/30564/matplotlib/issues/30564"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:25cf17f5-c2cb-d867-b6ae-da691f4026c8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A2D6:1ECA58:5345C:6D8CC:6A527EE4 |
| html-safe-nonce | b8c595b7e868099a9d743b79e4485561be6f45ddfd4b6ecc32a8d0cefb6523f8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMkQ2OjFFQ0E1ODo1MzQ1Qzo2RDhDQzo2QTUyN0VFNCIsInZpc2l0b3JfaWQiOiI2NDA2MDIyOTE4NjY5NzYyMjc2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1e5d4fc127c0e04458d2ac44d8ffe099a41c3908cf31fd17155ed81cd2137975 |
| hovercard-subject-tag | issue:3420136429 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/30564/issue_layout |
| twitter:image | https://opengraph.githubassets.com/00c24fc7b5661e6b79fcd041b3a89f991e613f0536dbb2ab7f2c98252e8b9a38/matplotlib/matplotlib/issues/30564 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/00c24fc7b5661e6b79fcd041b3a89f991e613f0536dbb2ab7f2c98252e8b9a38/matplotlib/matplotlib/issues/30564 |
| og:image:alt | Bug summary I noticed in a screenshot from another PR that out of the six backends displayed, only the Qt5Agg icon fails to adapt to dark mode. It remains black and blends in with the background, m... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | LangQi99 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width