← Winnitude! Search  ·  Reader Mode (974 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 20 LINKS

test(core): cover legacy comma-separated rgb() with percentages by slvs26 · Pull Request #11724 · NativeScript/NativeScript

Repository navigation

test(core): cover legacy comma-separated rgb() with percentages - #11724


Open
slvs26 wants to merge 1 commit into NativeScript:main from slvs26:test/color-legacy-rgb-percentages
Open

test(core): cover legacy comma-separated rgb() with percentages #11724 slvs26 wants to merge 1 commit into NativeScript:main from slvs26:test/color-legacy-rgb-percentages

Conversation

slvs26 commented Dec 3, 2026



Copy link Copy Markdown

PR Checklist

  • The PR title follows our guidelines.
  • There is an issue for the bug/feature this PR is for.
  • You have read and signed the CLA (signing in a comment on this PR).
  • All existing tests are passing.
  • Tests for the changes are included.

What is the current behavior?

#11525 reported that rgb() with percentages, as Sass emits from color.scale(), was read as plain numbers: rgb(100%, 50%, 0%) became rgb(100, 50, 0). #11532 fixed this on main by routing any rgb() with % through the CSS color parser. Its tests cover the space-separated form rgb(100% 0% 0%) but not the comma-separated form Sass actually outputs.

What is the new behavior?

No code change. This adds regression cases for the comma-separated form to packages/core/color/color.spec.ts:

  • rgb(100%, 50%, 0%) → rgba(255, 128, 0, 1.00)
  • rgba(100%, 50%, 0%, 0.5) → rgba(255, 128, 0, 0.50)
  • rgb(100%, 55.1764705882%, 10%), the exact output of Dart Sass for color.scale(#ff8000, $lightness: 10%) → rgba(255, 141, 26, 1.00)

With the color code from before #11532 these fail with the reported result, rgba(100, 50, 0, 1.00). On main they pass (npx vitest run color/ in packages/core: 7 tests).

Note: the issue's example rgb(100%, 50%, 0) mixes a percentage with a plain number in the comma syntax. CSS Color 4 treats that as invalid, so new Color() now throws Invalid color for it, and browsers reject it as well. Sass does not produce that form.

Closes #11525

🤖 Generated with Claude Code

test(core): cover legacy comma-separated rgb() with percentages b18108f
Sass emits colors such as rgb(100%, 55.1764705882%, 10%) from
color.scale(). These used to be read as plain 0-255 numbers. NativeScript#11532
routes them through the CSS color parser; add regression cases,
including real Sass output.

Closes NativeScript#11525

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed


No deployments
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

1 participant