UNPKG

@cerberus-design/react

Version:

The Cerberus Design React component library.

30 lines (29 loc) 1.09 kB
import { ColorModes, CustomThemes, DefaultThemes, ThemeContextValue } from '../context/theme'; /** * This module provides a hook for using the theme. * @module */ export declare const THEME_KEY = "cerberus-theme"; export declare const MODE_KEY = "cerberus-mode"; export interface UseThemeOptions<T extends string = DefaultThemes> { /** * Whether to cache the theme in local storage. */ cache?: boolean; /** * Called when the theme is updated. */ updateTheme?: (theme: T) => void; /** * Called when the color mode is updated. */ updateMode?: (mode: ColorModes) => void; } /** * Provides a hook for using the theme for a single instance of the application. * @see https://cerberus.digitalu.design/react/use-theme * @param defaultTheme The default theme. * @param defaultColorMode The default color mode. * @param options Additional options. */ export declare function useTheme<C extends string = DefaultThemes>(defaultTheme?: CustomThemes<C>, defaultColorMode?: ColorModes, options?: UseThemeOptions<C>): ThemeContextValue<C>;