-
Notifications
You must be signed in to change notification settings - Fork 545
chroma.js accepts invalid values (and converts them to 0), but not always #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think converting rgb(-1000, 0, 255) to [0, 0, 255] is the intended behavior, as this is just clipping the components to their valid range. Negative RGB channels can also be the result of converting certain Lab colors to RGB (which makes sense as RGB covers just a subset of colors). Converting There's an exception for the string As for |
Would we consider "silently converted my invalid r value to 0" to be a bug in each case above or is this in some way intended behavior? If I have user input for r, g and b is there a good way to validate it using chroma.js or do I need to do my own typechecking and bounds checking before passing to the library?
The text was updated successfully, but these errors were encountered: