⚡ Sangsakala Proxy 🏠 Home
Skip to content

fix(core): unresolved var() unsets the whole value and invalid color-mix() no longer renders white - #11593

Merged
NathanWalker merged 3 commits into
mainfrom
fix/color-mix-invalid-not-white
Oct 29, 2026
Merged

NathanWalker merged 3 commits into
mainfrom
fix/color-mix-invalid-not-white

Conversation

@edusperoni

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

  • argbFromColorMix() returns -1 when @csstools/css-color-parser cannot parse the value, and ColorBase stores it as the color. That is opaque white on Android, and transparent blue (invisible) on iOS, which builds the color from the r/g/b/a getters.
  • The usual trigger is an unresolved variable nested in a function. _evaluateCssVariableExpression substitutes unset inline, so color-mix(in srgb, var(--missing) 35%, transparent) becomes color-mix(in srgb, unset 35%, transparent), which fails to parse.
  • The same inline substitution makes calc(var(--missing) + 10) evaluate to 10.

What is the new behavior?

This follows the CSS spec:

  • Unresolved var(): a var() with no value (undefined, empty, or unset) and no fallback that resolves makes the whole declaration invalid at computed-value time, so the property is unset. This holds wherever the var() is nested: color-mix(), calc(), shorthands, multi-value strings. An unresolved var() inside the fallback of a var() that did resolve is ignored, as in browsers: var(--defined, var(--missing)) gives --defined.
  • Malformed color-mix(): throws Invalid color: <value>, like every other unparseable color string. The cascade already catches and traces that, so the declaration is dropped instead of painting white.

Behavior changes:

  • calc(var(--missing) + 10) is now unset instead of 10.
  • margin: var(--a) var(--missing) now unsets the whole shorthand instead of only the missing part.
  • The color-mix(in --swop5c, red, blue) spec used to assert the decoded -1 sentinel. It is now a throw case: without a color profile the value cannot be parsed, and browsers drop it too.

…mix() no longer renders white

A var() referencing an undefined or empty custom property, with no
fallback or with a fallback that also fails to resolve, now makes the
whole declaration unset, as CSS specifies for values that are invalid at
computed-value time. Before, `unset` was substituted inline, so values
like `color-mix(in srgb, var(--missing) 35%, transparent)` turned into
an unparseable color, and `calc(var(--missing) + 10)` evaluated to 10.

A color-mix() that fails to parse now throws `Invalid color: <value>`
like every other malformed color string, so the declaration is dropped.
Before, the parser's -1 sentinel was stored as the color, which renders
as white on Android and transparent blue on iOS.
@nx-cloud

nx-cloud Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 7880788

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 3m 53s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded 9s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-29 16:56:58 UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11593
npm i https://pkg.pr.new/@nativescript/vite@11593
npm i https://pkg.pr.new/@nativescript/webpack@11593

commit: 7880788

@edusperoni
edusperoni marked this pull request as ready for review October 29, 2026 15:39
# Conflicts:
#	packages/core/ui/core/properties/css-variable-expression.spec.ts
@NathanWalker
NathanWalker merged commit c7f905d into main Oct 29, 2026
10 checks passed
@NathanWalker
NathanWalker deleted the fix/color-mix-invalid-not-white branch October 29, 2026 17:09
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.

2 participants