UseColors
Last updated: 2.7.0 (16/06/2024)
This hook forms part of the Color utility system. For more information about how this system works, see Color.
useColors
is a hook that allows the usage of Valence colors in any component. All components must be a child of the ValenceProvider
to function correctly.
Usage
Return type
getSwatch
Gets the swatch for the given color key. If the color does not exist, this will return undefined
.
getHex
Gets the hex code for the given color key. If the color does not exist, this will return the key as-is.
getBgHex
(key: string, variant?: FillVariant, hovered?: boolean): string | undefined
Gets the most suitable background color, based upon the supplied parameters.
getBorderHex
(key: string, variant?: FillVariant, focused?: boolean)
Gets the most suitable border color, based upon the supplied parameters.
getFgHex
(key: string, variant?: FillVariant): string | undefined
Gets the most suitable foreground color, based upon the supplied parameters.
Changelog
2.7.0: added the
getBorderHex
method.
Last updated
Was this helpful?