import Color from "@arcgis/core/Color"; import type { ColorJson } from "@vertigis/arcgis-extensions/json/SymbolJson"; export declare const TRANSPARENT: Color; export declare const WCAG_AA_CONTRAST_RATIO = 4.5; /** * Defines a color by its hue, saturation, and value (brightness). Property * values range from 0..1. */ export interface Hsv { /** * Hue. */ h: number; /** * Saturation. */ s: number; /** * Value (brightness). */ v: number; /** * Alpha (transparency). */ a?: number; } /** * Defines a color by red, green, and blue values. Property values range from * 0..1. */ export interface Rgb { /** * Red. */ r: number; /** * Green. */ g: number; /** * Blue. */ b: number; /** * Alpha (transparency). */ a?: number; } /** * The result of createContrastColor(). */ export interface ContrastColorResult { /** * The contrast ratio between the original input color and the color in this * result. */ ratio: number; /** * The new contrast color. */ color: Color; } /** * Returns whether two ESRI Colors have the same RGBA values. * * @param color1 The first color. * @param color2 The second color. * @param ignoreA Whether to ignore the alpha value when comparing. Default is * false. */ export declare function colorsAreEqual(color1: Color, color2: Color, ignoreA?: boolean): boolean; /** * Converts from one of several formats to a Color object. * * @param value The value to convert. Supported formats are: * * - Hex string * - "rgb()" or "rgba()" string * - Number array (JSON format) * - Object with r, g, b, and a properties. */ export declare function toColor(value: unknown): Color; /** * Converts a color to an "rgba(...)" string. * * @param color The color to convert. */ export declare function toRgbaString(color: Color): string; /** * Converts a color to an "rgb(...)" string. * * @param color The color to convert. */ export declare function toRgbString(color: Color): string; /** * Lightens or darkens a color to create a new color that contrasts with the * original. This function yields a color whose contrast ratio is >= 4.5 making * it WCAG AA compliant. Prefers a light contrast color over a dark contrast * color if both are WCAG AA compliant. * * @param color The input color from which to generate a contrasting color. */ export declare function createContrastColor(color: Color): ContrastColorResult; /** * Darkens the color by an amount and returns the new color. * * @param amount Ranges from 0..1. * @param color The color to darken. */ export declare function darken(amount: number, color: Color): Color; /** * Lightens the color by an amount and returns the new color. * * @param amount Ranges from 0..1. * @param color The color to lighten. */ export declare function lighten(amount: number, color: Color): Color; /** * Blend a color with another by an amount and return a new color. Uses linear * interpolation in the RGB colorspace. * * @param color The original color. * @param blendWith The color to blend with. * @param amount Ranges from 0..1. */ export declare function blend(color: Color, blendWith: Color, amount: number): Color; /** * Calculates the contrast ratio between two colors. * * @param foregroundColor The foreground color. * @param backgroundColor The background color. * @returns A contrast ratio value in the range 0..21. */ export declare function getContrastRatio(foregroundColor: Color, backgroundColor: Color): number; /** * Choose between a light and dark text color by comparing the contrast to the * background color. The light color will be preferred as long as it exceeds the * WCAG AA contrast ratio threshold. * * @param background The background color to compare against. * @param lightColor The light color option. * @param darkColor The dark color option. */ export declare function getContrastText(background: Color, lightColor: Color, darkColor: Color): Color; /** * Returns the raw RGB values of the color See * https://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB for a detailed * discussion of this algorithm. * * @param color The color to convert. */ export declare function hsvToRgb(color: Hsv): Rgb; /** * Convert HSV to an instance of EsriColor. * * @param color The HSV value to convert. */ export declare function hsvToColor(color: Hsv): Color; /** * Convert from an instance of EsriColor to HSV. * * @param color The Color value to convert. */ export declare function colorToHsv(color: Color): Hsv; /** * Converts a Color to rgba number array, values ranging from 0..1. * * @param color The color to convert. */ export declare function colorToDecimalRgb(color: Color): number[]; /** * Converts raw RGB values to their HSV equivalents. Reverse of the above Also * discussed on this page: https://en.wikipedia.org/wiki/HSL_and_HSV. * * @param color The color to convert. */ export declare function decimalRgbToHsv(color: number[]): Hsv; /** * Generates random colors in [r, g, b, a] format. Uses evenly spaced hues * around the color wheel with some variation in saturation and brightness. * * @param count The number of colors to generate. */ export declare function generateRandomColors(count: number): ColorJson[];