diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index d869bcf8..7f18d142 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -6,6 +6,7 @@ import { headers } from "next/headers";
import { TRPCReactProvider } from "~/trpc/react";
import { ModalProvider } from "~/app/providers/modal";
import { BoardProvider } from "~/app/providers/board";
+import { ThemeProvider } from "./providers/theme";
const jakarta = Plus_Jakarta_Sans({
subsets: ["latin"],
@@ -27,11 +28,13 @@ export default function RootLayout({
return (
-
-
- {children}
-
-
+
+
+
+ {children}
+
+
+
);
diff --git a/src/app/providers/theme.tsx b/src/app/providers/theme.tsx
new file mode 100644
index 00000000..797e2d5a
--- /dev/null
+++ b/src/app/providers/theme.tsx
@@ -0,0 +1,70 @@
+"use client";
+
+import React, {
+ createContext,
+ useContext,
+ useEffect,
+ useState,
+ type ReactNode,
+} from "react";
+
+interface ThemeContextProps {
+ theme: string;
+ switchTheme: (theme: string) => void;
+}
+
+const ThemeContext = createContext(undefined);
+
+export const ThemeProvider: React.FC<{ children: ReactNode }> = ({
+ children,
+}) => {
+ const [theme, setTheme] = useState("");
+
+ const switchTheme = (theme: string) => {
+ if (theme === "system") {
+ localStorage.removeItem("theme");
+ } else {
+ if (theme === "dark") {
+ document.documentElement.classList.add("dark");
+ } else {
+ document.documentElement.classList.remove("dark");
+ }
+
+ localStorage.theme = theme;
+ }
+ setTheme(theme);
+ };
+
+ useEffect(() => {
+ if (!("theme" in localStorage)) {
+ if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
+ document.documentElement.classList.add("dark");
+ } else {
+ document.documentElement.classList.remove("dark");
+ }
+ setTheme("system");
+ } else {
+ if (localStorage.theme === "dark") {
+ document.documentElement.classList.add("dark");
+ setTheme("dark");
+ } else {
+ document.documentElement.classList.remove("dark");
+ setTheme("light");
+ }
+ }
+ }, []);
+
+ return (
+
+ {theme.length ? children : null}
+
+ );
+};
+
+export const useTheme = (): ThemeContextProps => {
+ const context = useContext(ThemeContext);
+ if (!context) {
+ throw new Error("useTheme must be used within a ThemeProvider");
+ }
+ return context;
+};
diff --git a/tailwind.config.ts b/tailwind.config.ts
index f482fd9e..44f9d0d7 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -2,6 +2,7 @@ import { type Config } from "tailwindcss";
export default {
content: ["./src/**/*.tsx"],
+ darkMode: 'class',
theme: {
extend: {
fontFamily: {
@@ -10,6 +11,9 @@ export default {
fontSize: {
sm: "0.8rem",
},
+ boxShadow: {
+ '3xl': '0px 16px 70px rgba(0, 0, 0, 0.5)',
+ },
colors: {
"dark-50": "#161616",
"dark-100": "#1c1c1c",
@@ -23,6 +27,17 @@ export default {
"dark-900": "#7e7e7e",
"dark-950": "#bbb",
"dark-1000": "#ededed",
+ "light-50": "hsl(0deg 0% 98.8%)",
+ "light-100": "hsl(0deg 0% 97.3%)",
+ "light-200": "hsl(0deg 0% 95.3%)",
+ "light-300": "hsl(0deg 0% 92.9%)",
+ "light-400": "hsl(0deg 0% 91%)",
+ "light-500": "hsl(0deg 0% 88.6%)",
+ "light-700": "hsl(0deg 0% 85.9%)",
+ "light-800": "hsl(0deg 0% 78%)",
+ "light-900": "hsl(0deg 0% 56.1%)",
+ "light-950": "hsl(0deg 0% 52.2%)",
+ "light-1000": "hsl(0deg 0% 43.5%)",
},
screens: {
xxl: '1600px'