[v4] Let's discuss about @theme and @variant to manage light and dark modes easily. #17218
ParaSpl01t
started this conversation in
Ideas
Replies: 1 comment
-
++ @theme {
--color-primary: #4c662b;
--color-secondary: #586249;
--color-tertiary: #386663;
--color-on-primary: #ffffff;
@variant dark {
--color-primary: #b1d18a;
--color-secondary: #bfcbad;
--color-tertiary: #a0d0cb;
--color-on-primary: #1f3701;
}
} We would only need to add something like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is how I'm managing light and dark modes as of now.
When the new and shiny
css
feature,var()
was first released. It made managing dark mode really easy, all we had to do was to change the variable value according to prefers-color-scheme. Since@theme
is now available in v4, i would love to use something similar in this syntax.I do not believe one way is better over other, but having this just gives users flexiblity to use what they are already fimiliar with. But this does one issue, the @theme is meant to modify tailwind utility classes like --color-slate-*, so --bg-base and --text-base will interfere. but, there might be better ways for me to handle the naming conventions.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions