/** * @description Palette type * @enum {string} * @readonly * @memberof Palette * @property {string} SEQUENTIAL - Sequential palette * @property {string} DIVERGING - Diverging palette * @property {string} QUALITATIVE - Qualitative palette */ export declare enum PaletteType { SEQUENTIAL = "sequential", DIVERGING = "diverging", QUALITATIVE = "qualitative" } /** * @description Palette provider * @enum {string} * @readonly * @memberof Palette * @property {string} CARTOCOLORS - CARTOColors palettes * @property {string} CMOCEAN - cmocean palettes * @property {string} COLORBREWER - ColorBrewer palettes * @property {string} LIGHTBARTLEIN - Light Bartlein palettes * @property {string} MATPLOTLIB - Matplotlib palettes * @property {string} MYCARTA - MyCarta palettes * @property {string} SCIENTIFIC - Fabio Crameri's Scientific palettes * @property {string} TABLEAU - Tableau palettes * @property {string} WESANDERSON - Wes Anderson palettes * @property {string} OKABEITO - Okabe & Ito's palette * @property {string} JOSHUASTEVENS - Joshua Stevens' palettes * @property {string} D3 - D3 / Observable palette */ export declare enum Provider { CARTOCOLORS = "cartocolors", CMOCEAN = "cmocean", COLORBREWER = "colorbrewer", LIGHTBARTLEIN = "lightbartlein", MATPLOTLIB = "matplotlib", MYCARTA = "mycarta", SCIENTIFIC = "scientific", TABLEAU = "tableau", WESANDERSON = "wesanderson", OKABEITO = "okabeito", JOSHUASTEVENS = "joshuastevens", D3 = "d3" } /** * @description A Palette object. * @typedef {Object} Palette * @property {string} id - Palette id * @property {string} name - Palette name * @property {number} number - Palette number * @property {PaletteType} type - Palette type * @property {string[]} colors - Palette colors (hexadecimal) * @property {Provider} provider - Palette provider * @property {string} [url] - Reference url * @property {boolean} [cbf] - Whether the palette is colorblind-friendly */ export type Palette = { id: string; name: string; number: number; type: PaletteType; colors: string[]; provider: Provider; url: string; cbf?: boolean; }; type PaletteDescriptionsType = { [key in Provider]: { [key in string]: any; }; }; /** * @description Get a palette, given a name and number of classes. If no palette is found, undefined is returned. * @param {string} name - Palette name * @param {number} number - Number of classes in the palette * @returns {Palette | undefined} - The corresponding palette (if any) */ export declare const getPalette: (name: string, number: number) => Palette | undefined; /** * @description Get a palette by id. If no palette is found, undefined is returned. * @param {string} id - Palette id (follows the pattern '{name}_{number}') * @returns {Palette | undefined} - The corresponding palette (if any) */ export declare const getPaletteById: (id: string) => Palette | undefined; /** * @description Get the colors of a palette, given its name and its number of classes. * @param {string} name - Palette name * @param {number} number - Number of classes in the palette * @param {boolean} reverse - Whether to reverse the order of the colors * @returns {string[] | undefined} - The colors of the palette (if any) */ export declare const getColors: (name: string, number: number, reverse?: boolean) => string[] | undefined; /** * @description Get the colors of a palette given its id. * @param {string} id - Palette id (follows the pattern '{name}_{number}') * @param {boolean} reverse - Whether to reverse the order of the colors * @returns {string[] | undefined} - The colors of the palette (if any) */ export declare const getColorsById: (id: string, reverse?: boolean) => string[] | undefined; /** * @description Returns palettes matching the requested criteria. Note that * 1) if no criteria is provided, all palettes are returned, * 2) if multiple criteria are provided, they are combined with AND, and * 3) the criteria are case-insensitive. * @param {Object} [options] - Options * @param {string} [options.type] - Palette type ('sequential', 'diverging' or 'qualitative') * @param {number} [options.number] - Number of classes in the palette * @param {string} [options.provider] - Palette provider * @param {string} [options.name] - Palette name * @returns {Palette[]} - Palettes matching the requested criteria, or all palettes if no criteria is provided */ export declare const getPalettes: (options?: { type?: string; number?: number; provider?: string; name?: string; }) => Palette[]; /** * @description Return the names of the palette providers. * @returns {string[]} - Palette providers */ export declare const getPaletteProviders: () => Provider[]; /** * @description Return the names of the palette types. * @returns {string[]} - Palette types */ export declare const getPaletteTypes: () => PaletteType[]; /** * @description Return the names of the palettes (for all providers if no provider is specified). * @param {string} [provider] - Palette provider * @returns {string[]} - Palette names */ export declare const getPaletteNames: (provider?: Provider) => string[]; /** * @description Return the available numbers of classes for a given palette name. * @param {string} name - Palette name * @returns {number[]} - Available numbers of classes */ export declare const getPaletteNumbers: (name: string) => number[]; /** * @description Get the raw description of the palettes (for all providers if no provider is specified, * otherwise for the specified provider). * @param {Provider} [provider] - Palette provider * @returns {Object} - Raw description of all the palette variations */ export declare const getRawData: (provider?: Provider) => { [x: string]: any; } | PaletteDescriptionsType; /** * @description Helper to generate colors for asymmetric diverging palettes, given an existing diverging palette name. * * @param {string} divergingSchemeName - Palette name * @param {number} classLeft - Number of classes on the left * @param {number} classRight - Number of classes on the right * @param {boolean} [centralClass=true] - Whether to include a central class * @param {boolean} [balanced=false] - Whether to balance the palette (i.e. the color progression is the same on the left and on the right) * @param {boolean} [reversed=false] - Whether to reverse the order of the colors * @return {string[]} - The generated palette, as an array of hexadecimal colors, of length classLeft + classRight + (centralClass ? 1 : 0). * @throws {Error} - If the number of classes is not valid (i.e. < 1) or if no palette is found for the requested name. */ export declare function getAsymmetricDivergingColors(divergingSchemeName: string, classLeft: number, classRight: number, centralClass?: boolean, balanced?: boolean, reversed?: boolean): string[]; /** * @description Helper to generate colors for a (maybe interpolated) sequential palette, * given an existing sequential palette name. * * @param {string} sequentialSchemeName - Palette name * @param {number} classNumber - Number of classes * @param {boolean} [reverse=false] - Whether to reverse the order of the colors * @return {string[]} - The generated palette, as an array of hexadecimal colors, of length classNumber. * @throws {Error} - If the number of classes is not valid (i.e. < 2) or if no palette is found for the requested name. */ export declare function getSequentialColors(sequentialSchemeName: string, classNumber: number, reverse?: boolean): string[]; /** * @description Function to add a new palette to the palette descriptions. * * @param {Object} palette - The palette to add * @param {string} palette.name - Palette name * @param {string} palette.type - Palette type ('sequential', 'diverging' or 'qualitative') * @param {string[]} palette.colors - Palette colors (hexadecimal) * @param {string} palette.provider - Palette provider * @param {string} [palette.url] - Reference url * @return {void} * @throws {Error} - If the palette object is invalid */ export declare function addPalette(palette: { name: string; type: string; colors: string[]; provider: string; url?: string; }): void; export {};