Define CSS variable theming with @theme directive or similar #13247
requestmethod
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The new @theme directive works great for defining the base set of variables that are pushed into all of TW utils classes. It would very handy to be able to create class based theme override mappings using a similar method.
What are class based theme overrides?
In the examples below, we have the same card HTML and base tokens and we want to render 3 entirely different themes: white, black and green by simply attaching a new theme css class.
In TW 3, you can define a plugin like mine here: https://github.com/requestmethod/tailwind-plugin-css-themes.
In TW 4, it would be great to handle this with CSS, possibly by using a directive similar to @theme.
Beta Was this translation helpful? Give feedback.
All reactions