/** * Class representing a Color with properties r, g, b and optionally a */ export declare class Color { readonly r: number; readonly g: number; readonly b: number; readonly a: number; /** * Construct the Color white * * @param alpha optional alpha value; defaults to 1 * * @returns a Color with rgba (255,255,255,a=1) */ static white(alpha?: number): Color; /** * Construct the Color black * * @param alpha optional alpha value; defaults to 1 * * @returns a Color with rgba (0,0,0,a=1) */ static black(alpha?: number): Color; /** * Construct the Color grey * * @param alpha optional alpha value; defaults to 1 * * @returns a Color with rgba (128,128,128,a=1) */ static grey(alpha?: number): Color; /** * Construct the Color red * * @param alpha optional alpha value; defaults to 1 * * @returns a Color with rgba (255,0,0,a=1) */ static red(alpha?: number): Color; /** * Construct the Color green * * @param alpha optional alpha value; defaults to 1 * * @returns a Color with rgba (0,255,0,a=1) */ static green(alpha?: number): Color; /** * Construct the Color blue * * @param alpha optional alpha value; defaults to 1 * * @returns a Color with rgba (0,0,255,a=1) */ static blue(alpha?: number): Color; /** * Construct the Color yellow * * @param alpha optional alpha value; defaults to 1 * * @returns a Color with rgba (255,255,0,a=1) */ static yellow(alpha?: number): Color; /** * Construct the Color magenta * * @param alpha optional alpha value; defaults to 1 * * @returns a Color with rgba (255,0,255,a=1) */ static magenta(alpha?: number): Color; /** * Construct the Color cyan * * @param alpha optional alpha value; defaults to 1 * * @returns a Color with rgba (0,255,255,a=1) */ static cyan(alpha?: number): Color; /** * Generate a random Color with r, g and b values * * Alpha value may be randomised or given as a fixed value * * @param randomAlpha whether or not to generate a random alpha; default is false * @param fixedAlpha a fixed Alpha to use if randomAlpha is false; default is 1 * * @returns a random Color */ static random(randomAlpha?: boolean, fixedAlpha?: number): Color; /** * Convenience method for generating a list of random Colors of a certain length * * Alphas may be randomised or given as a fixed value for all generated Colors * * @param count the number of colors to generate * @param randomAlpha whether or not to generate a random alpha for each Color; default is false * @param fixedAlpha a fixed Alpha to use for each Color if randomAlpha is false; default is 1 */ static randomList(count: number, randomAlpha?: boolean, fixedAlpha?: number): Array; /** * Create a custom Color with given r, g, b and a values * * r, g and b are clamped to 255, and a is clamped to 1. Negative values will be set to 0 * * @param r the Color's red value; 0-255; defaults to 0 * @param g the Color's green value; 0-255; defaults to 0 * @param b the Color's blue value; 0-255; defaults to 0 * @param a the Color's alpha value; 0-1; defaults to 1 * * @returns the Color */ static rgba(r?: number, g?: number, b?: number, a?: number): Color; /** * Create a custom Color for a given hex string * * The hex can be in the form #000000, 000000, #000 or 000. * * If the string is malformed or the wrong length, a default Color will be returned (0, 0, 0) * * Final r, g and b values are clamped to 255, and alpha will be 1 * * @param hex the hex to convert * * @returns the Color */ static hex(hex: string): Color; /** * Internal-use single-number hex converter * * @param n the number to convert * * @returns the hex form of the number */ private static toHex; /** * Private constructor. Take and store the Color's r, g, b and a properties * * r, g and b are clamped to 255, and a is clamped to 1. Negative values will be set to 0 * * Colors should be constructed with `Color.hex()` or `Color.rgba()` * * @param r the Color's red value; 0-255; defaults to 0 * @param g the Color's green value; 0-255; defaults to 0 * @param b the Color's blue value; 0-255; defaults to 0 * @param a the Color's alpha value; 0-1; defaults to 1 */ private constructor(); /** * Getter for the hex form of the Color */ get hex(): string; /** * Getter for the GL-friendly Float32Array form of the Color */ get float32Array(): Float32Array; /** * Internal-use getter for the gl-compatible clamped form of the Color's r number (0 -> 1) */ private get rf(); /** * Internal-use getter for the gl-compatible clamped form of the Color's g number (0 -> 1) */ private get gf(); /** * Internal-use getter for the gl-compatible clamped form of the Color's b number (0 -> 1) */ private get bf(); }