DocsCustomization
Dark mode
Sections have no dark styles of their own. They use your shadcn variables, so whatever you define under .dark is what they show.
Define the dark variables
shadcn init writes a .dark block into your globals.css. Edit it like the light one; every section picks it up.
.dark {
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--primary: oklch(0.922 0 0);
--primary-foreground: oklch(0.205 0 0);
--muted-foreground: oklch(0.708 0 0);
}Add a theme switch
This site uses next-themes with the class attribute, so the .dark class lands on <html> and the visitor's system setting is the default.
import { ThemeProvider } from "next-themes";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
{children}
</ThemeProvider>
</body>
</html>
);
}Check both themes
Every section is checked for WCAG AA contrast in light and dark with shadcn's default colors. If you change --muted-foreground or --primary, check the contrast of text on --background and --card again. The theme toggle in the header switches these docs, previews included.