shelving
Version:
Toolkit for using data in JavaScript.
19 lines (18 loc) • 1.04 kB
TypeScript
import { StringSchema, type StringSchemaOptions } from "./StringSchema.js";
/**
* Define a valid color hex string, e.g `#00CCFF`
*
* Ensures value is a string, enforces that the string is a valid Color.
* Checks Color scheme against a whitelist (always), and checks Color domain against a whitelist (optional).
* `null` is also a valid value if this field is not required.
*
* Colors are limited to 512 characters (this can be changed with `max`), but generally these won't be data: URIs so this is a reasonable limit.
*/
export declare class ColorSchema extends StringSchema {
constructor({ one, title, value, ...options }: Omit<StringSchemaOptions, "type" | "min" | "max" | "match" | "multiline">);
sanitize(insaneString: string): string;
}
/** Valid color hex string, e.g. `#00CCFF` (required because empty string is invalid). */
export declare const COLOR: ColorSchema;
/** Valid color hex string, e.g. `#00CCFF`, or `null` */
export declare const NULLABLE_COLOR: import("./NullableSchema.js").NullableSchema<string>;