Download client/src/theme-context.ts from automindy/fokemal: direct link, hf CLI and curl.
- Browser
- Download file 489 Bytes
-
https://huggingface.co/spaces/automindy/fokemal/resolve/main/client/src/theme-context.ts
- Command line
-
hf download hf://spaces/automindy/fokemal/client/src/theme-context.ts
-
curl -L -o theme-context.ts https://huggingface.co/spaces/automindy/fokemal/resolve/main/client/src/theme-context.ts
489 Bytes
| import { createContext, useContext } from 'react' | |
| export type Theme = 'system' | 'light' | 'dark' | |
| export interface ThemeContextValue { | |
| theme: Theme | |
| setTheme: (theme: Theme) => void | |
| resolvedDark: boolean | |
| } | |
| export const ThemeContext = createContext<ThemeContextValue | null>(null) | |
| export function useTheme(): ThemeContextValue { | |
| const context = useContext(ThemeContext) | |
| if (!context) { | |
| throw new Error('useTheme must be used within a ThemeProvider') | |
| } | |
| return context | |
| } | |