Skip to main content

useColorModeValue

useColorModeValue is a custom hook used to get the appropriate value based on the current color mode.

Import#

import { useColorModeValue } from "pearl-ui";

Return value#

The useColorModeValue hook returns the appropriate color as a string

Usage#

const appropriateColor = useColorModeValue("red", "blue");

Parameters#

NameRequiredTypeDescription
lightColortruePearlTheme['palette']The color value to return when the app is in light mode
darkColortruePearlTheme['palette']The color value to return when the app is in dark mode