Skip to content

fix(rgb): reject non-numeric channels - #399

Open
xianjianlf2 wants to merge 1 commit into
gka:mainfrom
xianjianlf2:fix/rgb-reject-nonnumeric-channels
Open

fix(rgb): reject non-numeric channels#399
xianjianlf2 wants to merge 1 commit into
gka:mainfrom
xianjianlf2:fix/rgb-reject-nonnumeric-channels

Conversation

@xianjianlf2

Copy link
Copy Markdown

What changed

Reject non-numeric channels passed through explicit RGB mode instead of silently converting them to 0.

Why

As discussed in #356, clipping out-of-range numeric channels is intentional, but nonsensical values such as strings or null should not be accepted as RGB channels. This keeps numeric clipping intact while making invalid RGB input fail clearly.

Fixes #356

Validation

  • npm test -- test/autodetect.test.js --run
  • pre-commit ran npm run lint and full npm test successfully: 50 test files, 2521 tests

@xianjianlf2
xianjianlf2 requested a review from gka as a code owner August 1, 2026 08:44
@changeset-bot

changeset-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6b285a8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

chroma.js accepts invalid values (and converts them to 0), but not always

1 participant