17 lines
351 B
TypeScript
17 lines
351 B
TypeScript
|
|
import { createContext } from "react";
|
||
|
|
|
||
|
|
export type Theme = "dark" | "light" | "system";
|
||
|
|
|
||
|
|
type ThemeProviderState = {
|
||
|
|
theme: Theme;
|
||
|
|
setTheme: (theme: Theme) => void;
|
||
|
|
};
|
||
|
|
|
||
|
|
const initialState: ThemeProviderState = {
|
||
|
|
theme: "system",
|
||
|
|
setTheme: () => null,
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ThemeProviderContext =
|
||
|
|
createContext<ThemeProviderState>(initialState);
|