Skip to content

Figure.image: Add parameter fgcolor/bgcolor/transparent_color and deprecate bitcolor [Will be removed in 0.24.0] - #4872

Merged
seisman merged 10 commits into
mainfrom
image/bitcolor
Sep 4, 2026
Merged

Figure.image: Add parameter fgcolor/bgcolor/transparent_color and deprecate bitcolor [Will be removed in 0.24.0]#4872
seisman merged 10 commits into
mainfrom
image/bitcolor

Conversation

@seisman

@seisman seisman commented Aug 30, 2026

Copy link
Copy Markdown
Member

Implement the -G option, as three separate parameters fgcolor/bgcolor/transparent_color, as proposed in #4263 (comment).

Supersedes #4280
Related to #4263.

@seisman seisman added this to the 0.20.0 milestone Aug 30, 2026
@seisman seisman added enhancement Improving an existing feature deprecation Deprecating a feature needs review This PR has higher priority and needs review. labels Aug 30, 2026
Comment thread pygmt/src/image.py Outdated
@seisman
seisman requested a lite review from Copilot September 3, 2026 10:02
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Sep 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A new user-facing parameter (transparent_color) is added without a positive (non-error) regression test to validate the intended -G+t output behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds support for GMT’s image -G behavior in pygmt.Figure.image by introducing explicit parameters for foreground/background/transparent colors while keeping the older bitcolor interface available under deprecation.

Changes:

  • Add bgcolor, fgcolor, and transparent_color parameters to Figure.image, and deprecate bitcolor with warnings + conflict validation.
  • Add image-comparison tests and baseline for bgcolor/fgcolor, plus validation tests for invalid inputs and deprecated-parameter interactions.
  • Cache the new sample dataset (@vader1.png) used by the new test.
File summaries
File Description
pygmt/src/image.py Implements -G via bgcolor/fgcolor/transparent_color and deprecates bitcolor with validation + alias mapping.
pygmt/tests/test_image.py Adds mpl baseline test for bgcolor/fgcolor and new validation/deprecation tests.
pygmt/tests/baseline/test_image_bgcolor_fgcolor.png New baseline image for the bgcolor/fgcolor mpl comparison test (LFS).
pygmt/helpers/caching.py Adds @vader1.png to cached datasets to support tests.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pygmt/tests/test_image.py
Comment thread pygmt/tests/test_image.py Outdated
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Sep 4, 2026
@seisman
seisman merged commit 4f8709e into main Sep 4, 2026
22 of 24 checks passed
@seisman
seisman deleted the image/bitcolor branch September 4, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprecation Deprecating a feature enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants