UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

47 lines (46 loc) 2.43 kB
import { ColorInstance as Color } from 'color'; import { Dimensions, Scale } from '../interfaces'; import { ColorValue, HSLA, HSVA, RGB, RGBA } from './interfaces'; import { STATIC_DIMENSIONS } from './resources'; export declare const hexChar: RegExp; export declare const alphaToOpacity: (alpha: number) => number; export declare const opacityToAlpha: (opacity: number) => number; export declare function isValidHex(hex: string, hasAlpha?: boolean): boolean; export declare function canConvertToHexa(hex: string): boolean; export declare function isShorthandHex(hex: string, hasAlpha?: boolean): boolean; export declare function isLonghandHex(hex: string, hasAlpha?: boolean): boolean; export declare function normalizeHex(hex: string, hasAlpha?: boolean, convertFromHexToHexa?: boolean): string; export declare function hexify(color: Color, hasAlpha?: boolean): string; export declare function rgbToHex(color: RGB | RGBA): string; export declare function normalizeAlpha<T extends RGBA | HSVA | HSLA>(colorObject: ReturnType<Color["object"]>): T; export declare function normalizeColor(alphaColorObject: RGBA | HSVA | HSLA): ReturnType<Color["object"]>; export declare function hexToRGB(hex: string, hasAlpha?: boolean): RGB | RGBA; type Enumify<T> = T[keyof T]; export declare const CSSColorMode: { HEX: "hex"; HEXA: "hexa"; RGB_CSS: "rgb-css"; RGBA_CSS: "rgba-css"; HSL_CSS: "hsl-css"; HSLA_CSS: "hsla-css"; }; type CSSColorMode = Enumify<typeof CSSColorMode>; export declare const ObjectColorMode: { RGB: "rgb"; RGBA: "rgba"; HSL: "hsl"; HSLA: "hsla"; HSV: "hsv"; HSVA: "hsva"; }; type ObjectColorMode = Enumify<typeof ObjectColorMode>; export type SupportedMode = CSSColorMode | ObjectColorMode; export type Format = "auto" | SupportedMode; export declare function parseMode(colorValue: ColorValue): SupportedMode | null; export declare function colorEqual(value1: Color | null, value2: Color | null): boolean; export declare function alphaCompatible(mode: SupportedMode): boolean; export declare function toAlphaMode(mode: SupportedMode): SupportedMode; export declare function toNonAlphaMode(mode: SupportedMode): SupportedMode; export declare function getSliderWidth(availableWidth: number, activeStaticDimensions: (typeof STATIC_DIMENSIONS)[Scale], hasAlpha: boolean): number; export declare function getColorFieldDimensions(availableWidth: number): Dimensions; export {};