UseColors
Last updated: 2.7.0 (16/06/2024)
Last updated
Was this helpful?
Last updated: 2.7.0 (16/06/2024)
Last updated
Was this helpful?
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.
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.
2.7.0: added the getBorderHex
method.
(key: string | undefined):
| undefined
(key: string | undefined, opacity?:
): string | undefined