/** * A color manipulation object. * @category Math */ export declare class Color { private glArray; /** * Creates a new Color instance. * @param r - A Color object or the red component [0 .. 255]. Defaults to 0. * @param g - The green component [0 .. 255]. Defaults to 0. * @param b - The blue component [0 .. 255]. Defaults to 0. * @param alpha - The alpha value [0.0 .. 1.0]. Defaults to 1. */ constructor(r?: Color | string | number, g?: number, b?: number, alpha?: number); /** * Gets the red component of the color. * @returns The red component [0 .. 255]. */ get r(): number; /** * Sets the red component of the color. * @param value - The red component [0 .. 255]. */ set r(value: number); /** * Gets the green component of the color. * @returns The green component [0 .. 255]. */ get g(): number; /** * Sets the green component of the color. * @param value - The green component [0 .. 255]. */ set g(value: number); /** * Gets the blue component of the color. * @returns The blue component [0 .. 255]. */ get b(): number; /** * Sets the blue component of the color. * @param value - The blue component [0 .. 255]. */ set b(value: number); /** * Gets the alpha component of the color. * @returns The alpha component [0.0 .. 1.0]. */ get alpha(): number; /** * Sets the alpha component of the color. * @param value - The alpha component [0.0 .. 1.0]. */ set alpha(value: number); /** * Sets the color to the specified values. * @param r - The red component [0 .. 255]. * @param g - The green component [0 .. 255]. * @param b - The blue component [0 .. 255]. * @param [alpha] - The alpha value [0.0 .. 1.0]. Defaults to 1. * @returns Reference to this object for method chaining. */ setColor(r?: number, g?: number, b?: number, alpha?: number): this; /** * Sets the color to the specified normalized float values. * @param r - The red component [0.0 .. 1.0]. * @param g - The green component [0.0 .. 1.0]. * @param b - The blue component [0.0 .. 1.0]. * @param [alpha=1.0] - The alpha value [0.0 .. 1.0]. Defaults to 1. * @returns Reference to this object for method chaining. */ setFloat(r: number, g: number, b: number, alpha?: number): this; /** * Sets the color to the specified HSV values. * @param h - The hue [0 .. 1]. * @param s - The saturation [0 .. 1]. * @param v - The value [0 .. 1]. * @returns Reference to this object for method chaining. */ setHSV(h: number, s: number, v: number): this; /** * Sets the color to the specified HSL values. * @param h - The hue [0 .. 1]. * @param s - The saturation [0 .. 1]. * @param l - The lightness [0 .. 1]. * @returns Reference to this object for method chaining. */ setHSL(h: number, s: number, l: number): this; /** * Creates a new copy of this color object. * @returns Reference to the newly cloned object. */ clone(): Color; /** * Copies a color object or CSS color into this one. * @param color - The color to copy. * @returns Reference to this object for method chaining. */ copy(color: Color | string): this; /** * Blends this color with the given one using addition. * @param color - The color to blend with. * @returns Reference to this object for method chaining. */ add(color: Color): this; /** * Darkens this color value by a given scale. * @param scale - The scale to darken the color by [0 .. 1]. * @returns Reference to this object for method chaining. */ darken(scale: number): this; /** * Linearly interpolates between this color and the given one. * @param color - The color to interpolate with. * @param alpha - The interpolation factor, with alpha = 0 being this color, and alpha = 1 being the given one. * @returns Reference to this object for method chaining. */ lerp(color: Color, alpha: number): this; /** * Lightens this color value by a given scale * @param scale - The scale to lighten the color by [0 .. 1]. * @returns Reference to this object for method chaining. */ lighten(scale: number): this; /** * Generate random r,g,b values for this color object * @param [min] - minimum value for the random range * @param [max] - maxmium value for the random range * @returns Reference to this object for method chaining */ random(min?: number, max?: number): this; /** * Checks if this color is equal to another. * @param color - The color to compare with. * @returns True if the colors are equal, otherwise false. */ equals(color: Color): boolean; /** * Parse a CSS color name and set this color to the corresponding r,g,b values * @param cssColor - The CSS color name * @returns Reference to this object for method chaining */ parseCSS(cssColor: string): this; /** * Parse an RGB or RGBA CSS color string * @param rgbColor - The RGB or RGBA color string to parse * @returns Reference to this object for method chaining */ parseRGB(rgbColor: string): this; /** * Parse a Hex color ("#RGB", "#RGBA" or "#RRGGBB", "#RRGGBBAA" format) and set this color to * the corresponding r,g,b,a values * @param hexColor - The Hex color string to parse * @param [argb] - true if format is #ARGB, or #AARRGGBB (as opposed to #RGBA or #RGGBBAA) * @returns Reference to this object for method chaining */ parseHex(hexColor: `#${string}`, argb?: boolean): this; /** * Pack this color RGB components into a Uint32 ARGB representation * @param [alpha] - alpha value [0.0 .. 1.0] * @returns A Uint32 ARGB representation of this color */ toUint32(alpha?: number): number; /** * return a Float Array representation of this object * @returns A Float Array representation of this color */ toArray(): Float32Array; /** * return the color in "#RRGGBB" format * @returns The color in "#RRGGBB" format */ toHex(): string; /** * Get the color in "#RRGGBBAA" format * @param alpha - The alpha value [0.0 .. 1.0] to use in the output string. * @returns The color in "#RRGGBBAA" format */ toHex8(alpha?: number): string; /** * Get the color in "rgb(R,G,B)" format * @returns The color in "rgb(R,G,B)" format */ toRGB(): `rgb(${number},${number},${number})`; /** * Get the color in "rgba(R,G,B,A)" format * @param [alpha] - alpha value [0.0 .. 1.0] * @returns The color in "rgba(R,G,B,A)" format */ toRGBA(alpha?: number): `rgba(${number},${number},${number},${number})`; } export declare const colorPool: import("../system/pool.ts").Pool; //# sourceMappingURL=color.d.ts.map