Dark mode
Toggle themes with a class on the root element.
How it works
Dark mode is a .dark class on <html> that swaps the variables. Add the custom variant once in your CSS:
@custom-variant dark (&:where(.dark, .dark *));To avoid a flash on load, set the class in a small inline script before your app renders, reading the saved choice or the system setting.
Tip
Press ⌘J (Ctrl+J on Windows) anywhere on this site to switch themes.