Repository navigation
ColorConverter: Fix HSV conversion at black and white boundaries. - #34806
Merged
Merged
Conversation
Mugen87
approved these changes
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ColorConverter.setHSV()produces NaN RGB channels for normalized black (v=0) and white (s=0, v=1) inputs.getHSV()likewise produces NaN saturation for black. Input clamping can reach these same boundaries.Guard the zero denominators while preserving hue wrapping, saturation/value clamping, the existing nonboundary arithmetic, and working-color-space behavior. Add six registered addon tests for achromatic colors, primaries, clamping, hue wrapping, round trips, and the linear working color space.
Validation on Node 24.19.0:
npm test: core lint passes, 1,524 core tests pass with one existing TODO, and all 433 addon tests pass.test-e2e-covexample inventory check pass. GPU backends were unavailable, so GPU-dependent assertions were skipped; rendered-example E2E was not run.Independent review checked 24,505 HSV inputs and 1,331 RGB inputs against separate conversion oracles; all previously finite sampled results remain unchanged. Implementation and independent review were AI-assisted.