You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bring back named opacity support for color opacity modifiers (#15009)
This PR reverts #14278
to bring back support for using named opacity values in color opacity
modifiers:
```css
@theme {
--opacity-myOpacity: 50%;
}
```
```html
<div class="bg-red-500/myOpacity"></div>
```
We briefly discuss to restructure the code so that we avoid adding a
`theme` argument to the call sites but I do still prefer the current
approach for the following reasons: The way to avoid this is to a) put
something in either the `Theme` class scope, where it feels grossly out
of place, or b) put it into the shared closure in the utilities file
which is already very large and hard to reason. Furthermore, there's a
second call site in the compile function where we would need to
duplicate the namespace lookup.
Every caller of the current `asColor` value already has access to the
`Theme` so passing that as an argument seems like the least intrusive
way.
## Test Plan
Brought back the unit tests but I also tested it with the Vite
extension:
<img width="744" alt="Screenshot 2024-11-15 at 11 15 05"
src="https://github.com/user-attachments/assets/63923b80-767e-4104-b7eb-f71fc815b51e">
---------
Co-authored-by: Adam Wathan <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
-
- Nothing yet!
10
+
### Changed
11
+
12
+
- Bring back support for color opacity modifiers to read from `--opacity-*` theme values ([#14278](https://github.com/tailwindlabs/tailwindcss/pull/14278))
0 commit comments