Skip to content

fix: assign the "over" color to napari's high_color, not nan_color - #145

Merged
tlambert03 merged 1 commit into
pyapp-kit:mainfrom
matthiasschabel:fix/napari-high-color
Aug 10, 2026
Merged

fix: assign the "over" color to napari's high_color, not nan_color#145
tlambert03 merged 1 commit into
pyapp-kit:mainfrom
matthiasschabel:fix/napari-high-color

Conversation

@matthiasschabel

Copy link
Copy Markdown
Contributor

Colormap.to_napari() checks for napari's high_color field but assigns the over color to nan_color (src/cmap/_external.py:115), introduced in #103.

Two effects:

  • high_color is never set, so values above the range fall back to napari's default instead of the requested over color;
  • the assignment runs after the bad_color branch, so an explicitly configured bad color is silently replaced by the over color.

One-line fix plus a regression test asserting that low_color, high_color, and nan_color each receive their own color. The test requires napari >= 0.6.1, where those three fields were added — below that the converter correctly skips them.

🤖 Generated with Claude Code

to_napari() checked for napari's high_color field but assigned the over
color to nan_color, so high_color was never set and an explicitly
configured bad color was silently replaced by the over color.

Adds a regression test asserting that low_color, high_color, and
nan_color each receive their own color. It requires napari >= 0.6.1,
where those three fields were introduced.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reviewed-By: Codex (gpt-5.6-sol, reasoning effort xhigh)
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.60%. Comparing base (8040ef7) to head (ba7129b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #145      +/-   ##
==========================================
+ Coverage   95.56%   95.60%   +0.04%     
==========================================
  Files         168      168              
  Lines        2186     2186              
==========================================
+ Hits         2089     2090       +1     
+ Misses         97       96       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matthiasschabel
matthiasschabel marked this pull request as ready for review August 9, 2026 21:05
@matthiasschabel matthiasschabel changed the title fix: assign the over color to napari's high_color, not nan_color fix: assign the "over" color to napari's high_color, not nan_color Aug 9, 2026
@tlambert03

Copy link
Copy Markdown
Member

thanks

@tlambert03
tlambert03 merged commit 6e560c3 into pyapp-kit:main Aug 10, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants