Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Rebase `url()` inside imported CSS files when using Vite ([#14877](https://github.com/tailwindlabs/tailwindcss/pull/14877))
- Ensure that CSS transforms from other Vite plugins correctly work in full builds (e.g. `:deep()` in Vue) ([#14871](https://github.com/tailwindlabs/tailwindcss/pull/14871))
- Don't unset keys like `--inset-shadow-*` when unsetting keys like `--inset-*` ([#14906](https://github.com/tailwindlabs/tailwindcss/pull/14906))
- Fix opacity modifier using CSS variables ([#14916](https://github.com/tailwindlabs/tailwindcss/pull/14916))
- _Upgrade (experimental)_: Install `@tailwindcss/postcss` next to `tailwindcss` ([#14830](https://github.com/tailwindlabs/tailwindcss/pull/14830))
- _Upgrade (experimental)_: Remove whitespace around `,` separator when print arbitrary values ([#14838](https://github.com/tailwindlabs/tailwindcss/pull/14838))
- _Upgrade (experimental)_: Fix crash during upgrade when content globs escape root of project ([#14896](https://github.com/tailwindlabs/tailwindcss/pull/14896))
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwindcss/src/compat/plugin-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ describe('theme', async () => {
color: color-mix(in oklch, #ef4444 50%, transparent);
}
.variable {
color: color-mix(in oklch, #ef4444 calc(var(--opacity) * 100%), transparent);
color: color-mix(in oklch, #ef4444 var(--opacity), transparent);
}
:root {
--color-red-500: #ef4444;
Expand Down
4 changes: 2 additions & 2 deletions packages/tailwindcss/src/css-functions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe('theme function', () => {
}

.red {
color: color-mix(in oklch, red calc(var(--opacity) * 100%), transparent);
color: color-mix(in oklch, red var(--opacity), transparent);
}"
`)
})
Expand All @@ -237,7 +237,7 @@ describe('theme function', () => {
}

.red {
color: color-mix(in oklch, red calc(var(--opacity, 50%) * 100%), transparent);
color: color-mix(in oklch, red var(--opacity, 50%), transparent);
}"
`)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwindcss/src/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9969,7 +9969,7 @@ test('bg', async () => {
}

.bg-current\\/\\[var\\(--bg-opacity\\)\\] {
background-color: color-mix(in oklch, currentColor calc(var(--bg-opacity) * 100%), transparent);
background-color: color-mix(in oklch, currentColor var(--bg-opacity), transparent);
}

.bg-inherit {
Expand Down
7 changes: 0 additions & 7 deletions packages/tailwindcss/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,6 @@ export function withAlpha(value: string, alpha: string): string {
alpha = `${alphaAsNumber * 100}%`
}

// If the alpha value is a percentage, we can pass it directly to
// `color-mix()`. In any other case, e.g.: `var(…)`, `round(…)`, … we need to
// make sure it's a percentage.
else if (alpha[alpha.length - 1] !== '%') {
alpha = `calc(${alpha} * 100%)`
}

return `color-mix(in oklch, ${value} ${alpha}, transparent)`
}

Expand Down