Skip to content

RS-22278: Fix Values color option error when values are all identical#14

Merged
chschan merged 1 commit into
masterfrom
RS-22278-values-color-identical
Jul 1, 2026
Merged

RS-22278: Fix Values color option error when values are all identical#14
chschan merged 1 commit into
masterfrom
RS-22278-values-color-identical

Conversation

@chschan

@chschan chschan commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

GetVectorOfColors normalized color.values via (vals - min) / max(vals - min). When every value is the same the range is zero, so this computes 0/0 = NaN, which colorRamp propagates and rgb() rejects with "color intensity NA, not in 0:255".

Guard the zero-range case and map all values to the midpoint of the color scale (0.5) instead. For the reported 3-colour custom palette this resolves to the middle colour, matching the expected result.

GetVectorOfColors normalized color.values via (vals - min) / max(vals - min).
When every value is the same the range is zero, so this computes 0/0 = NaN,
which colorRamp propagates and rgb() rejects with "color intensity NA, not in
0:255".

Guard the zero-range case and map all values to the midpoint of the color
scale (0.5) instead. For the reported 3-colour custom palette this resolves to
the middle colour, matching the expected result.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chschan chschan requested a review from JustinCCYap July 1, 2026 06:56

@JustinCCYap JustinCCYap 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.

LGTM

@chschan chschan merged commit b1c18ce into master Jul 1, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants