Skip to content

docs(cloud): note the color-mix() limitation in standalone app styles - #413

Merged
ValentinKolb merged 2 commits into
mainfrom
docs/color-mix-limitation
Sep 29, 2026
Merged

ValentinKolb merged 2 commits into
mainfrom
docs/color-mix-limitation

Conversation

@ValentinKolb

Copy link
Copy Markdown
Collaborator

Outcome

Application authors now learn, in the styling guide, how to keep mixed colors in a standalone application's src/styles/app.css: give each color-mix() that references a CSS variable or currentColor its own rule, split @apply lists with opacity modifiers on variable colors into one rule per utility, and declare a reused mix once as a custom property in its own rule. The dependency policy links the note and says to remove it together with the bun-plugin-tailwind patch.

Root cause

Bun 1.4.2 keeps only one of several adjacent @supports rules with the same condition (oven-sh/bun#24770). Tailwind's color-mix() polyfill emits one such rule per declaration. The root patch to bun-plugin-tailwind@0.1.2 turns that polyfill off, but root patches apply only inside this repository; the published @k2b/cloud build uses the unpatched plugin, and the plugin exposes no option to turn the polyfill off. Until a Bun release includes oven-sh/bun#38589, a standalone application's rule with several such mixes keeps only one mixed value.

Documentation

  • frontend/styling-and-accessibility.md: new section "Mix variable colors in separate rules" with the affected cases (declarations, @apply opacity modifiers, mixed custom properties), what is not affected (literal color mixes, the same utilities used as classes in markup), and examples.
  • contributing/dependency-policy.md: the bun-plugin-tailwind row links the note and lists it as part of the patch's removal.

Verification

  • bun run check:docs in docs-site (page rules, links, and anchors) passes.
  • bun run check passes.
  • git diff --check is clean.

The underlying fix still needs a Bun release with oven-sh/bun#38589 and a Bun bump, so the issue stays open.

Refs #321

The repository patch for bun-plugin-tailwind only applies inside this
monorepo. A standalone application compiles src/styles/app.css with the
unpatched plugin, and Bun 1.4.2 then keeps only the first color-mix()
that references a variable or currentColor in each rule; the others
show Tailwind's fallback. The plugin exposes no option to turn the
polyfill off, so until a Bun release includes oven-sh/bun#38589 the
styling guide tells application authors to give each such color-mix()
its own rule, or to declare a reused mix once as a custom property in
its own rule. The dependency policy links the note and removes it
together with the patch.

Refs #321
The note said the build keeps the first mixed value in a rule. That holds
for plain declarations, but @apply emits its declarations in Tailwind's
property order, so with the unpatched plugin
`@apply bg-(--k2b-action)/12 border-(--k2b-action)/40` keeps the border mix
and drops the background mix. Say "only one" instead of "the first", and
tell authors that opacity modifiers on variable or currentColor colors in
@apply compile to color-mix() and need one rule per utility. The same
utilities used as classes in markup compile to separate rules and are not
affected.

Refs #321
@ValentinKolb
ValentinKolb added this pull request to the merge queue Sep 29, 2026
Merged via the queue into main with commit fdb1178 Sep 29, 2026
17 checks passed
@ValentinKolb
ValentinKolb deleted the docs/color-mix-limitation branch September 29, 2026 00:59
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.

1 participant