Conversation
…or spaces When percentages are omitted in color-mix(), the descriptor contains trailing null values that were not consumed, causing args.length validation to fail. Consume trailing null/undefined values and register OKLCH, HSL, Lab, and LCH color spaces.
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.
Summary
Handle omitted percentages in
colorMixruntime evaluation and register OKLCH, HSL, Lab, and LCH color spaces withcolorjs.io.Problem and Reproduction
When percentages are omitted in
color-mix()(such ascolor-mix(in oklab, var(--color) 50%, transparent)), the compiled descriptor tuple contains trailingnullvalues:At runtime in
color-mix.ts,percentage()returnedundefinedwithout shiftingnull, leavingargs = [null]. The subsequentif (args.length) return;check failed and evaluated toundefined.Reproduction
Key Changes
Runtime
src/native/styles/functions/color-mix.ts: Consume trailingnull/undefineddescriptor values beforeargs.lengthcheck.OKLCH,HSL,Lab, andLCHcolor spaces withcolorjs.io.Tests
src/__tests__/native/color-mix.test.tsx: Add test coverage forhslandoklchcolor spaces.