interface SpaceFormat {
    [instance]?: Format;
    alpha?: boolean;
    commas?: boolean;
    coordGrammar?: (string & {
        range?: [number, number];
    })[];
    coords?: string[];
    id?: string;
    ids?: string[];
    name?: string;
    parse?: ((str: string) => ColorConstructor);
    serialize?: ((coords: Coords, alpha: number, opts?: Record<string, any>) => string);
    serializeCoords?: ((coords: Coords, precision: number) => [string, string, string]);
    space?: Space;
    test?: ((str: string) => boolean);
    toGamut?: boolean;
    type?: string;
}

Properties

[instance]?: Format
alpha?: boolean

Whether to always have alpha at the end (true), never (false), or auto (undefined)

commas?: boolean

Whether commas should separate arguments for a format

coordGrammar?: (string & {
    range?: [number, number];
})[]
coords?: string[]
id?: string
ids?: string[]
name?: string
"color"
parse?: ((str: string) => ColorConstructor)

Function to parse a string into a color

serialize?: ((coords: Coords, alpha: number, opts?: Record<string, any>) => string)

Serialize coordinates and an alpha channel into a string. Must be defined for a format to support serialization

serializeCoords?: ((coords: Coords, precision: number) => [string, string, string])
space?: Space
test?: ((str: string) => boolean)
toGamut?: boolean

Whether to adjust the coordinates to fit in the gamut

type?: string
"function"