cpt2js
Version:
Color palette text parser to a function, input compatible with GMT, GDAL, GRASS, PostGIS, ArcGIS
22 lines (17 loc) • 839 B
TypeScript
import { Scale } from 'chroma-js';
export { Scale } from 'chroma-js';
type PaletteColor = string | number | [string, string, string] | [number, number, number] | [string, string, string, string] | [number, number, number, number];
type PaletteEntry = [string | number, PaletteColor];
type PaletteArray = PaletteEntry[];
type Palette = string | PaletteArray;
interface ParseOptions {
bounds?: [number, number];
}
declare function parsePalette(palette: Palette, { bounds }?: ParseOptions): Scale;
interface ColorRampCanvasOptions {
width?: number;
height?: number;
}
declare function colorRampCanvas(scale: Scale, { width, height }?: ColorRampCanvasOptions): HTMLCanvasElement;
export { colorRampCanvas, parsePalette };
export type { ColorRampCanvasOptions, Palette, PaletteArray, PaletteColor, PaletteEntry, ParseOptions };