hexColor
Creates a hex color validation action.
const Action = v.hexColor<TInput, TMessage>(message);
Generics
TInputextends stringTMessageextends ErrorMessage<HexColorIssue<TInput>> | undefined
Parameters
messageTMessage
Explanation
With hexColor you can validate the formatting of a string. If the input is not a hex color, you can use message to customize the error message.
Returns
ActionHexColorAction<TInput, TMessage>
Examples
The following examples show how hexColor can be used.
Hex color schema
Schema to validate a hex color.
const HexColorSchema = v.pipe(
v.string(),
v.hexColor('The hex color is badly formatted.')
);
Related
The following APIs can be combined with hexColor.
Schemas
Methods
Utils
© Fabian Hiller
Licensed under the MIT License.
https://valibot.dev/api/hexColor/