Branchwell

Become a Pro / website · becomeapro.ai / src / components / theme / theme-provider.tsx

Raw 651 B on 5069836c1e4c4e369ebe86b13dc7d299c5bed8c0
1"use client";
2
3import type { ReactNode } from "react";
4import { usePathname } from "next/navigation";
5import { 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.
8export 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}