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.
switchColorMode"light" | "dark" | "system"Function to switch the active color mode to a specific mode.

Usage#

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