Skip to content

[v4] Dark mode? #14615

Answered by ParasSolanki
ev3rlost asked this question in Help
Oct 7, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

In v4 for the dark mode with class="dark" selector you have to add following @variant css in your global tailwindcss file.

@variant dark (&:where(.dark, .dark *));

The cool thing is we can customize this easily and if we want dark mode on attribute for example [data-theme="dark"]

@variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));

Here's video where Adam explains this https://www.youtube.com/live/y4i_CXXWLoQ?si=XOexSQT1trFSQxZi&t=2028

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ev3rlost
Comment options

Answer selected by ev3rlost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants