export declare type ColorRGB = { r: number; g: number; b: number; }; /** * Defines HSL-formatted colors. * @package modules/helpers */ export declare type ColorHSL = { h: number; s: number; l: number; }; /** * Handles transformation of colors between hexadecimal representation and RGB and HSL representation. * Providers functions to decide if a color is dark enough to read white text on it * or light enough to read white text. * * @package modules/helpers */ export declare class Color { static random(): Color; private r; private g; private b; /** * Construct a new color instance. Accepts hexadecimal formatted colors as string or colors formatted as RGB or HSL. * @param color string|ColorRGB|ColorHSL */ constructor(color?: string | ColorRGB | ColorHSL); /** * Converts this color to a hexadecimal string. */ toHEX(): string; /** * Converts this color to a RGB formatted representation. */ toRGB(): ColorRGB; /** * Converts this color to a HSL formatted representation. */ toHSL(): ColorHSL; /** * Calculate the grayscale of this color. */ getGrayscale(): number; /** * Decide if this color is dark enough so white text could be read. */ isDark(): boolean; /** * Decide if this color is light enough so black text could be read. */ isLight(): boolean; /** * Checks if a given color is formatted as a string containing a hexadecimal * representation of a color * @param color string|ColorRGB|ColorHSL The color */ private isHEX; /** * Checks if a given color is given in a RGB-representation. * @param color string|ColorRGB|ColorHSL The color */ private isRGB; /** * Checks if a given color is given in a HSL-representation. * @param color string|ColorRGB|ColorHSL The color */ private isHSL; /** * Converts a string representation of a color to a RGB representation. * @param color string The hexadecimal representation of a color */ private readHEX; /** * Read a color formatted as RGB. No transformation required because colors are stored as RGB internally. * @param color ColorRGB The color formatted as RGB. */ private readRGB; /** * Read a color formatted as HSL. * @param color ColorHSL The color formatted as HSL */ private readHSL; private hue2rgb; }