UNPKG

@ngageoint/color-js

Version:
361 lines 8.59 kB
/** * Color representation with support for hex, RBG, arithmetic RBG, HSL, and * integer colors * * @author osbornb */ export declare class Color { /** * Red arithmetic color value */ private red; /** * Green arithmetic color value */ private green; /** * Blue arithmetic color value */ private blue; /** * Opacity arithmetic value */ private opacity; /** * Create a black color * * @return color */ static black(): Color; /** * Create a blue color * * @return color */ static blue(): Color; /** * Create a brown color * * @return color */ static brown(): Color; /** * Create a cyan color * * @return color */ static cyan(): Color; /** * Create a dark gray color * * @return color */ static darkGray(): Color; /** * Create a gray color * * @return color */ static gray(): Color; /** * Create a green color * * @return color */ static green(): Color; /** * Create a light gray color * * @return color */ static lightGray(): Color; /** * Create a magenta color * * @return color */ static magenta(): Color; /** * Create an orange color * * @return color */ static orange(): Color; /** * Create a pink color * * @return color */ static pink(): Color; /** * Create a purple color * * @return color */ static purple(): Color; /** * Create a red color * * @return color */ static red(): Color; /** * Create a violet color * * @return color */ static violet(): Color; /** * Create a white color * * @return color */ static white(): Color; /** * Create a yellow color * * @return color */ static yellow(): Color; /** * Create the color in hex * * @param color * hex color in format #RRGGBB, RRGGBB, #RGB, RGB, #AARRGGBB, * AARRGGBB, #ARGB, or ARGB * @return color */ static color(color: string): Color; /** * Set the color as a single integer or Set the color in hex * * @param color * color integer or hex color in format #RRGGBB, RRGGBB, #RGB, RGB, #AARRGGBB, * AARRGGBB, #ARGB, or ARGB */ setColor(color: string | number | string): void; /** * Set the color with HSLA (hue, saturation, lightness, alpha) values * * @param hue * hue value inclusively between 0.0 and 360.0 * @param saturation * saturation inclusively between 0.0 and 1.0 * @param lightness * lightness inclusively between 0.0 and 1.0 * @param alpha * alpha inclusively between 0.0 and 1.0 */ setColorByHSL(hue: number, saturation: number, lightness: number, alpha?: number): void; /** * Set the red color as an integer or hex * * @param red * red integer color inclusively between 0 and 255 or red hex color in format RR or R */ setRed(red: string | number): void; /** * Set the green color as an integer orr hex * * @param green * green integer color inclusively between 0 and 255 or in format GG or G */ setGreen(green: string | number): void; /** * Set the blue color as an integer or hex * * @param blue * blue integer color inclusively between 0 and 255 or in format BB or B */ setBlue(blue: string | number): void; /** * Set the opacity as an arithmetic float * * @param opacity * opacity float color inclusively between 0.0 and 1.0 */ setOpacity(opacity: number): void; /** * Set the alpha color as an arithmetic float or hex * * @param alpha * alpha float color inclusively between 0.0 and 1.0 or hex color in format AA or A */ setAlpha(alpha: string | number): void; /** * Check if the color is opaque (opacity or alpha of 1.0, 255, or x00) * * @return true if opaque */ isOpaque(): boolean; /** * Get the color as a hex string * * @return hex color in the format #RRGGBB */ getColorHex(): string; /** * Get the color as a hex string with alpha * * @return hex color in the format #AARRGGBB */ getColorHexWithAlpha(): string; /** * Get the color as a hex string, shorthanded when possible * * @return hex color in the format #RGB or #RRGGBB */ getColorHexShorthand(): string; /** * Get the color as a hex string with alpha, shorthanded when possible * * @return hex color in the format #ARGB or #AARRGGBB */ getColorHexShorthandWithAlpha(): string; /** * Get the color as an integer * * @return integer color */ getColor(): number; /** * Get the color as an integer including the alpha * * @return integer color */ getColorWithAlpha(): number; /** * Get the red color in hex * * @return red hex color in format RR */ getRedHex(): string; /** * Get the green color in hex * * @return green hex color in format GG */ getGreenHex(): string; /** * Get the blue color in hex * * @return blue hex color in format BB */ getBlueHex(): string; /** * Get the alpha color in hex * * @return alpha hex color in format AA */ getAlphaHex(): string; /** * Get the red color in hex, shorthand when possible * * @return red hex color in format R or RR */ getRedHexShorthand(): string; /** * Get the green color in hex, shorthand when possible * * @return green hex color in format G or GG */ getGreenHexShorthand(): string; /** * Get the blue color in hex, shorthand when possible * * @return blue hex color in format B or BB */ getBlueHexShorthand(): string; /** * Get the alpha color in hex, shorthand when possible * * @return alpha hex color in format A or AA */ getAlphaHexShorthand(): string; /** * Get the red color as an integer * * @return red integer color inclusively between 0 and 255 */ getRed(): number; /** * Get the green color as an integer * * @return green integer color inclusively between 0 and 255 */ getGreen(): number; /** * Get the blue color as an integer * * @return blue integer color inclusively between 0 and 255 */ getBlue(): number; /** * Get the alpha color as an integer * * @return alpha integer color inclusively between 0 and 255 */ getAlpha(): number; /** * Get the red color as an arithmetic float * * @return red float color inclusively between 0.0 and 1.0 */ getRedArithmetic(): number; /** * Get the green color as an arithmetic float * * @return green float color inclusively between 0.0 and 1.0 */ getGreenArithmetic(): number; /** * Get the blue color as an arithmetic float * * @return blue float color inclusively between 0.0 and 1.0 */ getBlueArithmetic(): number; /** * Get the opacity as an arithmetic float * * @return opacity float inclusively between 0.0 and 1.0 */ getOpacity(): number; /** * Get the alpha color as an arithmetic float * * @return alpha float color inclusively between 0.0 and 1.0 */ getAlphaArithmetic(): number; /** * Get the HSL (hue, saturation, lightness) values * * @return HSL array where: 0 = hue, 1 = saturation, 2 = lightness */ getHSL(): number[]; /** * Get the HSL hue value * * @return hue value */ getHue(): number; /** * Get the HSL saturation value * * @return saturation value */ getSaturation(): number; /** * Get the HSL lightness value * * @return lightness value */ getLightness(): number; /** * Copy the color * * @return color copy */ copy(): Color; setRGB(red: any, green: any, blue: any, alpha?: any): void; } //# sourceMappingURL=Color.d.ts.map