diff --git a/jquery.color/jquery.color.d.ts b/jquery.color/jquery.color.d.ts index 427890a41..8d5000a6c 100644 --- a/jquery.color/jquery.color.d.ts +++ b/jquery.color/jquery.color.d.ts @@ -1,46 +1,150 @@ // Type definitions for jquery.color.js v2.1.2 +// Project: https://github.com/jquery/jquery-color +// Definitions by: Derek Cicerone // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + interface JQueryColor { - /** - * Returns the alpha value of this color. - */ - alpha(): number; - - /** - * Returns the hexadecimal representation. - */ - toHexString(): string; - - /** - * Returns a CSS string like "rgba(255, 255, 255, 0.4)". - */ - toRgbaString(): string; - - /** - * The color distance (0.0 - 1.0) of the way between this color and othercolor. - */ - transition(othercolor: JQueryColor, distance: number): JQueryColor; - - /** - * Checks if two colors are equal. - */ - is(otherColor: JQueryColor): boolean; - /** * Returns the red component of the color (integer from 0 - 255). */ red(): number; + /** + * Returns a copy of the color object with the red set to val. + */ + red(val: number): JQueryColor; + /** * Returns the green component of the color (integer from 0 - 255). */ green(): number; + /** + * Returns a copy of the color object with the green set to val. + */ + green(val: number): JQueryColor; + /** * Returns the blue component of the color (integer from 0 - 255). */ blue(): number; + + /** + * Returns a copy of the color object with the blue set to val. + */ + blue(val: number): JQueryColor; + + /** + * Returns the alpha value of this color (float from 0.0 - 1.0). + */ + alpha(): number; + + /** + * Returns a copy of the color object with the alpha set to val. + */ + alpha(val: number): JQueryColor; + + /** + * Returns the hue component of the color (integer from 0 - 359). + */ + hue(): number; + + /** + * Returns a copy of the color object with the hue set to val. + */ + hue(val: number): JQueryColor; + + /** + * Returns the saturation component of the color (float from 0.0 - 1.0). + */ + saturation(): number; + + /** + * Returns a copy of the color object with the saturation set to val. + */ + saturation(val: number): JQueryColor; + + /** + * Returns the lightness component of the color (float from 0.0 - 1.0). + */ + lightness(): number; + + /** + * Returns a copy of the color object with the lightness set to val. + */ + lightness(val: number): JQueryColor; + + /** + * Returns a rgba "tuple" [ red, green, blue, alpha ]. + */ + rgba(): number[]; + + /** + * Returns a copy of the color with any defined values set to the new value. + */ + rgba(red: number, green: number, blue: number, alpha?: number): JQueryColor; + + /** + * Returns a copy of the color with any defined values set to the new value. + */ + rgba(val: RgbaColor): JQueryColor; + + /** + * Returns a copy of the color with any defined values set to the new value. + */ + rgba(vals: number[]): JQueryColor; + + /** + * Returns a HSL tuple [ hue, saturation, lightness, alpha ]. + */ + hsla(): number[]; + + /** + * Returns a copy of the color with any defined values set to the new value. + */ + hsla(hue: number, saturation: number, lightness: number, alpha?: number): JQueryColor; + + /** + * Returns a copy of the color with any defined values set to the new value. + */ + hsla(val: HslaColor): JQueryColor; + + /** + * Returns a copy of the color with any defined values set to the new value. + */ + hsla(vals: number[]): JQueryColor; + + /** + * Returns a CSS string "rgba(255, 255, 255, 0.4)". + */ + toRgbaString(): string; + + /** + * Returns a css string "hsla(330, 75%, 25%, 0.4)". + */ + toHslaString(): string; + + /** + * Returns a css string "#abcdef", with "includeAlpha" uses "#rrggbbaa" (alpha *= 255). + */ + toHexString(includeAlpha?: boolean): string; + + /** + * The color distance (0.0 - 1.0) of the way between this color and othercolor. + */ + transition(othercolor: JQueryColor, distance: number): JQueryColor; + + /** + * Will apply this color on top of the other color using alpha blending. + */ + blend(othercolor: JQueryColor): void; + + /** + * Checks if two colors are equal. + */ + is(otherColor: JQueryColor): boolean; } interface HslaColor {