-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
next-themes.d.ts
46 lines (43 loc) · 2.04 KB
/
next-themes.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
declare module 'next-themes' {
type ValueObject = Record<string, string>
interface UseThemeProps {
/** List of all available theme names */
themes: string[]
/** Forced theme name for the current page */
forcedTheme?: string
/** Update the theme */
setTheme: (theme: string) => void
/** Active theme name */
theme?: string
/** If `enableSystem` is true and the active theme is "system", this returns whether the system preference resolved to "dark" or "light". Otherwise, identical to `theme` */
resolvedTheme?: string
/** If enableSystem is true, returns the System theme preference ("dark" or "light"), regardless what the active theme is */
systemTheme?: 'dark' | 'light'
}
interface ThemeProviderProps {
/** List of all available theme names */
themes?: string[]
/** Forced theme name for the current page */
forcedTheme?: string
/** Whether to switch between dark and light themes based on prefers-color-scheme */
enableSystem?: boolean
/** Disable all CSS transitions when switching themes */
disableTransitionOnChange?: boolean
/** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */
enableColorScheme?: boolean
/** Key used to store theme setting in localStorage */
storageKey?: string
/** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */
defaultTheme?: string
/** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) */
attribute?: string | 'class'
/** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */
value?: ValueObject
/** Nonce string to pass to the inline script for CSP headers */
nonce?: string
}
export const useTheme: () => UseThemeProps
export const ThemeProvider: React.FC<
React.PropsWithChildren<ThemeProviderProps>
>
}