Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How do you guys manage DarkMode in Tailwind ?. using dark:bg-xxx or are there any better way ?


There’s fundamentally two ways. First is what you just stated with the modifier. The second way is to redefine the colors with CSS vars and then write a normal CSS media class that re-wires what var means what color.


That's what I would do and use the dark: classes for adding borders and other styles that make dark themes work. F.e. shadows and floating cards doesn't really work with dark themes but does with light colors.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: