Skip to content
Discussion options

You must be logged in to vote

It seems like you're trying to use a dark class name to toggle between dark and light mode. By default, Tailwind uses the prefers-color-scheme media query. So, to use a class name toggle instead, you'd need to configure Tailwind to do so:

-@import 'tailwindcss'
+@import 'tailwindcss';

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

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@DARK7177
Comment options

@DARK7177
Comment options

Answer selected by DARK7177
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #18206 on June 02, 2025 18:02.