You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While errors are nicely informative, this makes it annoying to develop UIs that use it (including components), where there are often intermediate states with incorrect values (e.g. a user is in the middle of typing a color, or a color channel is set before the color space is).
Case in point that finally prompted me to post an issue: this PR
For things like the color constructor, throwing makes sense and is helpful. But e.g. does it make sense here?
Perhaps we should have some kind of opt-in mode for these errors? Or just warn? A warning serves the same purpose, and is less disruptive to calling code.
The text was updated successfully, but these errors were encountered:
If you don't mind me chiming in. While there exist methods such as CSS.supports('color', yourQuestionableColor) I found that various color values would produce a true without being parsable. Something like isValid/canParse would surely be a big help here. Unfortunately Colorjs is currently wired to immediatly throw errors if a color fails to parse.
Would you recommend i need to write this into a promise to avoid this problem?
While errors are nicely informative, this makes it annoying to develop UIs that use it (including components), where there are often intermediate states with incorrect values (e.g. a user is in the middle of typing a color, or a color channel is set before the color space is).
Case in point that finally prompted me to post an issue: this PR
For things like the color constructor, throwing makes sense and is helpful. But e.g. does it make sense here?
color.js/src/space.js
Line 268 in d49b1ae
Perhaps we should have some kind of opt-in mode for these errors? Or just warn? A warning serves the same purpose, and is less disruptive to calling code.
The text was updated successfully, but these errors were encountered: