mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
This PR reverts https://github.com/tailwindlabs/tailwindcss/pull/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>