-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <adam.wathan@gmail.com>
- Loading branch information
1 parent
953ecd2
commit 2a6cd94
Showing
4 changed files
with
44 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters