Skip to main content

useTheme

useTheme is a custom hook used to get the active theme object, active color mode, and a function to toggle the active color mode.

Import#

import { useTheme } from "pearl-ui";

Return value#

NameTypeDescription
themePearlThemeTheme configuration object for the active color mode
colorMode"light" |"dark"Active color mode
toggleColorMode() => voidFunction to toggle the active color mode

Usage#

const { theme, colorMode, toggleColorMode } = useTheme();