Title: [MNT]: Color normalization in GraphicsContextBase · Issue #31105 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: Color normalization in GraphicsContextBase · Issue #31105 · matplotlib/matplotlib
X Title: [MNT]: Color normalization in GraphicsContextBase · Issue #31105 · matplotlib/matplotlib
Description: Summary We have class GraphicsContextBase: def set_foreground(self, fg, isRGBA=False): """ Set the foreground color. Parameters ---------- fg : :mpltype:`color` isRGBA : bool If *fg* is known to be an ``(r, g, b, a)`` tuple, *isRGBA* can...
Open Graph Description: Summary We have class GraphicsContextBase: def set_foreground(self, fg, isRGBA=False): """ Set the foreground color. Parameters ---------- fg : :mpltype:`color` isRGBA : bool If *fg* is known to be...
X Description: Summary We have class GraphicsContextBase: def set_foreground(self, fg, isRGBA=False): """ Set the foreground color. Parameters ---------- fg : :mpltype:`color` isRGBA : bool If *fg*...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31105
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: Color normalization in GraphicsContextBase","articleBody":"### Summary\n\nWe have\n```python\nclass GraphicsContextBase:\n\n def set_foreground(self, fg, isRGBA=False):\n \"\"\"\n Set the foreground color.\n\n Parameters\n ----------\n fg : :mpltype:`color`\n isRGBA : bool\n If *fg* is known to be an ``(r, g, b, a)`` tuple, *isRGBA* can be\n set to True to improve performance.\n \"\"\"\n```\nIt feels unnecessary and like a mental burden to handle unnormalized colors the GraphicsContext. Flexible color names is primarily a user-facing topic; and maybe (t.b.d.) an artist topic so that they can reproduce a color exactly as it was specified by the user (`a.set.color(c); a.get_color == c`). But I think the GraphicsContext should not need to bother with this. It should only need rgba information.\n\nPossible improvement:\n- Discourage isRGBA=False\n- internally only use isRGBA=True\n- At some point deprecatee the isRGBA argument and remove (as part of general backend API evolution).\n\nSemi-OT: is `set_foreground` the right abstraction or should we rather have `set_rgba()` and discorage `set_foreground`? Related: https://github.com/matplotlib/matplotlib/pull/31094#issuecomment-3859586784\n\n\n\n### Proposed fix\n\n_No response_","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2026-02-06T11:12:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/31105/matplotlib/issues/31105"}
| 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:f12acb71-5394-ea43-1192-f1bd20393069 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA6E:350532:34364F:45EC21:6A52474E |
| html-safe-nonce | 17db674c03d5d2deed558aeb9a981606d124e184a0ea09784c89ca438a0328b6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTZFOjM1MDUzMjozNDM2NEY6NDVFQzIxOjZBNTI0NzRFIiwidmlzaXRvcl9pZCI6IjIwMzE0MjQ4MDE4NjcyMjEyNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9c5cd92d23624c478627cc11db63e7a19ea3777ca5e6f04e4f5172f75aa12024 |
| hovercard-subject-tag | issue:3906238582 |
| 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/31105/issue_layout |
| twitter:image | https://opengraph.githubassets.com/35bb97c29e66c538536b80a6a270cc27cde6fabb2e3e6d2f78ac48ae45dc748d/matplotlib/matplotlib/issues/31105 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/35bb97c29e66c538536b80a6a270cc27cde6fabb2e3e6d2f78ac48ae45dc748d/matplotlib/matplotlib/issues/31105 |
| og:image:alt | Summary We have class GraphicsContextBase: def set_foreground(self, fg, isRGBA=False): """ Set the foreground color. Parameters ---------- fg : :mpltype:`color` isRGBA : bool If *fg* is known to be... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | timhoffm |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width