Interface SerializeOptions

interface SerializeOptions {
    alpha?:
        | boolean
        | "<percentage>"
        | "<number>"
        | {
            include?: boolean;
            type?: "<percentage>" | "<number>";
        };
    collapse?: boolean;
    commas?: boolean;
    coords?: string[];
    format?: string | SpaceFormat;
    inGamut?: boolean;
    precision?: number;
}

Properties

alpha?:
    | boolean
    | "<percentage>"
    | "<number>"
    | {
        include?: boolean;
        type?: "<percentage>" | "<number>";
    }

Alpha format

collapse?: boolean

Whether or not to collapse colors to three- or four-digit hex when possible

true
commas?: boolean

Force commas as a separator

false
coords?: string[]

Coordinate format to override the default

format?: string | SpaceFormat

Output format id. Defaults to the parsed format if available (and can serialize), or the color space default otherwise

"default"
inGamut?: boolean

Adjust coordinates to fit in gamut first

false
precision?: number

Significant digits