ColorSchemaclass
new ColorSchema({ one = "color", title = "Color", value = "#000000", input = "color", max = 7, ...options }: ColorSchemaOptions)| Param | Type | |
|---|---|---|
options | ColorSchemaOptions | Options for a ColorSchema. required |
.value | string | Default hex value used when the input is undefined. Defaults to "#000000" readonly |
.max | number | Maximum allowed character length. Defaults to 7 readonly |
.case | "upper""lower" | Force the result to "upper" or "lower" case. readonly |
.input | StringInputType | HTML <input /> type="" hint for downstream UIs. Defaults to "color" readonly |
| Return | |
|---|---|
ColorSchema | Schema that defines a valid color hex string, e.g. #00CCFF |
Schema that defines a valid color hex string, e.g. #00CCFF
- Coerces the value to a six-digit uppercase
#RRGGBBhex string. - Rejects anything that isn't a valid hex color (use
NULLABLE_COLORto also allownull).
Examples
COLOR.validate("00ccff"); // Returns "#00CCFF"