/** * A colour on either side of the boundary. * * The language carries a colour as four numbers, three whole channels and an * alpha that is an ordinary number from 0 to 1. A chart carries one as a CSS * string. The two directions are not symmetric and it is worth saying why. * * **Out of the language, nothing is lost.** The functional form is written * rather than eight hexadecimal digits, because a hexadecimal alpha is a byte * and the language's is not: `fade(x, 93)` is an alpha of 0.07, which no pair of * hexadecimal digits holds exactly, and a study whose band came back a shade off * would be a difference nobody could account for. * * **Into the language, alpha is the part that goes missing.** A chart's colour * control is a swatch with no alpha channel, so the value it stores back is six * digits and the transparency the script asked for is gone. Rather than turn * every translucent input opaque the first time somebody opens the dialog, a * value with no alpha of its own keeps the alpha the script declared, and only * a value that states one replaces it. * * A per-bar colour reaches a chart through the values table, which holds columns * of numbers, so it travels as two columns: the three channels packed into one * whole number, and the alpha beside them as itself. One column would have to * put the alpha in a byte and lose exactly what the functional form is here to * keep. */ import type { ColourValue, Value } from '../../core/engine/index.js'; /** The CSS spelling of a colour. */ export declare function cssColour(colour: ColourValue): string; /** The CSS spelling of a value that may not be a colour at all. */ export declare function cssOf(value: Value): string | undefined; export declare function isColourValue(value: Value): value is ColourValue; export declare function colourOf(r: number, g: number, b: number, a: number): ColourValue; /** * A CSS colour back into the language's four numbers. * * `alpha` is what a value with no alpha of its own is given: the alpha the * script declared for that input, so a swatch that cannot express transparency * does not remove it. Anything unparseable is nothing, which the caller turns * into the refusal the input's own validation would have produced. */ export declare function parseColour(text: string, alpha: number): ColourValue | undefined; /** The three channels as one whole number, for a column of per-bar colours. */ export declare function packChannels(colour: ColourValue): number; /** The CSS spelling of a packed triple and the alpha that travelled beside it. */ export declare function unpackColour(packed: number, alpha: number): string; //# sourceMappingURL=colours.d.ts.map