import '../../../assert/js/assert.js';
import '../../../globals.js';
/**
 * A color with RGBA values, assuming the sRGB color space is used.
 *
 * See http://www.w3.org/TR/css3-color/
 *
 * TODO: make a getHue, getSaturation, getLightness. we can then expose them via ES5! https://github.com/phetsims/scenery/issues/1581
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import TEmitter from '../../../axon/js/TEmitter.js';
import IOType from '../../../tandem/js/types/IOType.js';
import { TPaint } from '../imports.js';
import TColor from './TColor.js';
type FormatParser = {
    regexp: RegExp;
    apply: (color: Color, matches: RegExpExecArray) => void;
};
export default class Color {
    r: number;
    g: number;
    b: number;
    a: number;
    private _css?;
    private immutable?;
    readonly changeEmitter: TEmitter;
    /**
     * Creates a Color with an initial value. Multiple different types of parameters are supported:
     * - new Color( color ) is a copy constructor, for a {Color}
     * - new Color( string ) will parse the string assuming it's a CSS-compatible color, e.g. set( 'red' )
     * - new Color( r, g, b ) is equivalent to setRGBA( r, g, b, 1 ), e.g. set( 255, 0, 128 )
     * - new Color( r, g, b, a ) is equivalent to setRGBA( r, g, b, a ), e.g. set( 255, 0, 128, 0.5 )
     * - new Color( hex ) will set RGB with alpha=1, e.g. set( 0xFF0000 )
     * - new Color( hex, a ) will set RGBA, e.g. set( 0xFF0000, 1 )
     * - new Color( null ) will be transparent
     *
     * The 'r', 'g', and 'b' values stand for red, green and blue respectively, and will be clamped to integers in 0-255.
     * The 'a' value stands for alpha, and will be clamped to 0-1 (floating point)
     * 'hex' indicates a 6-decimal-digit format hex number, for example 0xFFAA00 is equivalent to r=255, g=170, b=0.
     *
     * @param r - See above for the possible overloaded values
     * @param [g] - If provided, should be the green value (or the alpha value if a hex color is given)
     * @param [b] - If provided, should be the blue value
     * @param [a] - If provided, should be the alpha value
     */
    constructor(color: Color);
    constructor(string: string);
    constructor(r: number, g: number, b: number, a?: number);
    constructor(hex: number, a?: number);
    constructor(transparent: null);
    /**
     * Returns a copy of this color.
     */
    copy(): Color;
    /**
     * Sets the values of this Color. Supported styles:
     *
     * - set( color ) is a copy constructor
     * - set( string ) will parse the string assuming it's a CSS-compatible color, e.g. set( 'red' )
     * - set( r, g, b ) is equivalent to setRGBA( r, g, b, 1 ), e.g. set( 255, 0, 128 )
     * - set( r, g, b, a ) is equivalent to setRGBA( r, g, b, a ), e.g. set( 255, 0, 128, 0.5 )
     * - set( hex ) will set RGB with alpha=1, e.g. set( 0xFF0000 )
     * - set( hex, alpha ) will set RGBA, e.g. set( 0xFF0000, 1 )
     * - set( null ) will be transparent
     *
     * @param r - See above for the possible overloaded values
     * @param [g] - If provided, should be the green value (or the alpha value if a hex color is given)
     * @param [b] - If provided, should be the blue value
     * @param [a] - If provided, should be the alpha value
     */
    set(r: number | Color | string | null, g?: number, b?: number, a?: number): this;
    /**
     * Returns the red value as an integer between 0 and 255
     */
    getRed(): number;
    get red(): number;
    set red(value: number);
    /**
     * Sets the red value.
     *
     * @param value - Will be clamped to an integer between 0 and 255
     */
    setRed(value: number): this;
    /**
     * Returns the green value as an integer between 0 and 255
     */
    getGreen(): number;
    get green(): number;
    set green(value: number);
    /**
     * Sets the green value.
     *
     * @param value - Will be clamped to an integer between 0 and 255
     */
    setGreen(value: number): this;
    /**
     * Returns the blue value as an integer between 0 and 255
     */
    getBlue(): number;
    get blue(): number;
    set blue(value: number);
    /**
     * Sets the blue value.
     *
     * @param value - Will be clamped to an integer between 0 and 255
     */
    setBlue(value: number): this;
    /**
     * Returns the alpha value as a floating-point value between 0 and 1
     */
    getAlpha(): number;
    get alpha(): number;
    set alpha(value: number);
    /**
     * Sets the alpha value.
     *
     * @param value - Will be clamped between 0 and 1
     */
    setAlpha(value: number): this;
    /**
     * Sets the value of this Color using RGB integral between 0-255, alpha (float) between 0-1.
     */
    setRGBA(red: number, green: number, blue: number, alpha: number): this;
    /**
     * A linear (gamma-corrected) interpolation between this color (ratio=0) and another color (ratio=1).
     *
     * @param otherColor
     * @param ratio - Not necessarily constrained in [0, 1]
     */
    blend(otherColor: Color, ratio: number): Color;
    /**
     * Used internally to compute the CSS string for this color. Use toCSS()
     */
    private computeCSS;
    /**
     * Returns the value of this Color as a CSS string.
     */
    toCSS(): string;
    /**
     * Sets this color for a CSS color string.
     */
    setCSS(cssString: string): this;
    /**
     * Returns this color's RGB information in the hexadecimal number equivalent, e.g. 0xFF00FF
     */
    toNumber(): number;
    /**
     * Called to update the internally cached CSS value
     */
    private updateColor;
    /**
     * Allow setting this Color to be immutable when assertions are disabled. any change will throw an error
     */
    setImmutable(): this;
    /**
     * Returns an object that can be passed to a Canvas context's fillStyle or strokeStyle.
     */
    getCanvasStyle(): string;
    /**
     * Sets this color using HSLA values.
     *
     * TODO: make a getHue, getSaturation, getLightness. we can then expose them via ES5! https://github.com/phetsims/scenery/issues/1581
     *
     * @param hue - integer modulo 360
     * @param saturation - percentage
     * @param lightness - percentage
     * @param alpha
     */
    setHSLA(hue: number, saturation: number, lightness: number, alpha: number): this;
    equals(color: Color): boolean;
    /**
     * Returns a copy of this color with a different alpha value.
     */
    withAlpha(alpha: number): Color;
    private checkFactor;
    /**
     * Matches Java's Color.brighter()
     */
    brighterColor(factor?: number): Color;
    /**
     * Brightens a color in RGB space. Useful when creating gradients from a single base color.
     *
     * @param [factor] - 0 (no change) to 1 (white)
     * @returns - (closer to white) version of the original color.
     */
    colorUtilsBrighter(factor?: number): Color;
    /**
     * Matches Java's Color.darker()
     */
    darkerColor(factor?: number): Color;
    /**
     * Darken a color in RGB space. Useful when creating gradients from a single
     * base color.
     *
     * @param [factor] - 0 (no change) to 1 (black)
     * @returns - darker (closer to black) version of the original color.
     */
    colorUtilsDarker(factor?: number): Color;
    /**
     * Like colorUtilsBrighter/Darker, however factor should be in the range -1 to 1, and it will call:
     *   colorUtilsBrighter( factor )   for factor >  0
     *   this                           for factor == 0
     *   colorUtilsDarker( -factor )    for factor <  0
     *
     * @param factor from -1 (black), to 0 (no change), to 1 (white)
     */
    colorUtilsBrightness(factor: number): Color;
    /**
     * Returns a string form of this object
     */
    toString(): string;
    /**
     * Convert to a hex string, that starts with "#".
     */
    toHexString(): string;
    toStateObject(): {
        r: number;
        g: number;
        b: number;
        a: number;
    };
    /**
     * Utility function, see http://www.w3.org/TR/css3-color/
     */
    static hueToRGB(m1: number, m2: number, h: number): number;
    /**
     * Convenience function that converts a color spec to a color object if necessary, or simply returns the color object
     * if not.
     *
     * Please note there is no defensive copy when a color is passed in unlike PaintDef.
     */
    static toColor(colorSpec: TColor): Color;
    /**
     * Interpolates between 2 colors in RGBA space. When distance is 0, color1 is returned. When distance is 1, color2 is
     * returned. Other values of distance return a color somewhere between color1 and color2. Each color component is
     * interpolated separately.
     *
     * @param color1
     * @param color2
     * @param distance distance between color1 and color2, 0 <= distance <= 1
     */
    static interpolateRGBA(color1: Color, color2: Color, distance: number): Color;
    /**
     * Returns a blended color as a mix between the given colors.
     */
    static supersampleBlend(colors: Color[]): Color;
    static fromStateObject(stateObject: {
        r: number;
        g: number;
        b: number;
        a: number;
    }): Color;
    static hsla(hue: number, saturation: number, lightness: number, alpha: number): Color;
    static checkPaintString(cssString: string): void;
    /**
     * A Paint of the type that Paintable accepts as fills or strokes
     */
    static checkPaint(paint: TPaint): void;
    /**
     * Gets the luminance of a color, per ITU-R recommendation BT.709, https://en.wikipedia.org/wiki/Rec._709.
     * Green contributes the most to the intensity perceived by humans, and blue the least.
     * This algorithm works correctly with a grayscale color because the RGB coefficients sum to 1.
     *
     * @returns - a value in the range [0,255]
     */
    static getLuminance(color: Color | string): number;
    /**
     * Converts a color to grayscale.
     */
    static toGrayscale(color: Color | string): Color;
    /**
     * Determines whether a color is 'dark'.
     *
     * @param color - colors with luminance < this value are dark, range [0,255], default 186
     * @param luminanceThreshold - colors with luminance < this value are dark, range [0,255], default 186
     */
    static isDarkColor(color: Color | string, luminanceThreshold?: number): boolean;
    /**
     * Determines whether a color is 'light'.
     *
     * @param color
     * @param [luminanceThreshold] - colors with luminance >= this value are light, range [0,255], default 186
     */
    static isLightColor(color: Color | string, luminanceThreshold?: number): boolean;
    /**
     * Creates a Color that is a shade of gray.
     * @param rgb - used for red, blue, and green components
     * @param [a] - defaults to 1
     */
    static grayColor(rgb: number, a?: number): Color;
    /**
     * Converts a CSS color string into a standard format, lower-casing and keyword-matching it.
     */
    private static preprocessCSS;
    /**
     * Whether the specified CSS string is a valid CSS color string
     */
    static isCSSColorString(cssString: string): boolean;
    static formatParsers: FormatParser[];
    static basicColorKeywords: Record<string, string>;
    static colorKeywords: Record<string, string>;
    static BLACK: Color;
    static BLUE: Color;
    static CYAN: Color;
    static DARK_GRAY: Color;
    static GRAY: Color;
    static GREEN: Color;
    static LIGHT_GRAY: Color;
    static MAGENTA: Color;
    static ORANGE: Color;
    static PINK: Color;
    static RED: Color;
    static WHITE: Color;
    static YELLOW: Color;
    static TRANSPARENT: Color;
    static black: Color;
    static blue: Color;
    static cyan: Color;
    static darkGray: Color;
    static gray: Color;
    static green: Color;
    static lightGray: Color;
    static magenta: Color;
    static orange: Color;
    static pink: Color;
    static red: Color;
    static white: Color;
    static yellow: Color;
    static transparent: Color;
    static ColorIO: IOType;
}
export type ColorState = {
    r: number;
    g: number;
    b: number;
    a: number;
};
export {};
//# sourceMappingURL=Color.d.ts.map