AI Resource Pro / website · airesourcepro.com / src / components / theme / theme-provider.tsx
| 1 | "use client"; |
| 2 | |
| 3 | import type { ReactNode } from "react"; |
| 4 | import { usePathname } from "next/navigation"; |
| 5 | import { ThemeProvider as NextThemesProvider } from "next-themes"; |
| 6 | |
| 7 | // Light and dark themes, remembered per browser. The home page stays dark: its particle field is light drawn on a dark void. |
| 8 | export function ThemeProvider({ children }: { children: ReactNode }) { |
| 9 | const pathname = usePathname(); |
| 10 | return ( |
| 11 | <NextThemesProvider |
| 12 | attribute="class" |
| 13 | defaultTheme="dark" |
| 14 | enableSystem |
| 15 | disableTransitionOnChange |
| 16 | forcedTheme={pathname === "/" ? "dark" : undefined} |
| 17 | > |
| 18 | {children} |
| 19 | </NextThemesProvider> |
| 20 | ); |
| 21 | } |