Files
eranos/src/hooks/useTheme.ts
T
shakespeare.diy 98ff1e09e0 New project created with Shakespeare
Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
2026-02-16 16:54:01 -06:00

20 lines
514 B
TypeScript

import { type Theme } from "@/contexts/AppContext";
import { useAppContext } from "@/hooks/useAppContext";
/**
* Hook to get and set the active theme
* @returns Theme context with theme and setTheme
*/
export function useTheme(): { theme: Theme; setTheme: (theme: Theme) => void } {
const { config, updateConfig } = useAppContext();
return {
theme: config.theme,
setTheme: (theme: Theme) => {
updateConfig((currentConfig) => ({
...currentConfig,
theme,
}));
}
}
}