From 297e70484e07161ea11d6f27e01699a2a85d3040 Mon Sep 17 00:00:00 2001 From: Niels van Hoorn Date: Mon, 26 Jun 2017 15:06:22 +0200 Subject: [PATCH] Added ColorInput type --- types/tinycolor2/index.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/types/tinycolor2/index.d.ts b/types/tinycolor2/index.d.ts index 7ad9d849a2..a84cfef5fb 100644 --- a/types/tinycolor2/index.d.ts +++ b/types/tinycolor2/index.d.ts @@ -70,7 +70,7 @@ interface tinycolor { * @param firstColor - the first color to be used in the comparison. * @param secondColor - the second color to be used in the comparison. */ - readability(firstColor: tinycolorInstance, secondColor: tinycolorInstance): Readable.Readable; + readability(firstColor: ColorInput, secondColor: ColorInput): Readable.Readable; /** * Ensure that foreground and background color combinations provide sufficient contrast. @@ -90,7 +90,7 @@ interface tinycolor { mostReadable(color: tinycolorInstance, colorsToCompare: tinycolorInstance[]): tinycolorInstance; /**/ - mix(color1: tinycolorInstance, color2: tinycolorInstance, amount?: number): tinycolorInstance; + mix(color1: ColorInput, color2: ColorInput, amount?: number): tinycolorInstance; /** * Returns a random color @@ -265,7 +265,6 @@ interface tinycolorInstance { * Default value: 10. */ darken(amount?: number): tinycolorInstance; - /** * Desaturate the color a given amount. * Providing 100 will is the same as calling greyscale. @@ -380,6 +379,8 @@ declare namespace ColorFormats { } } +type ColorInput = string | ColorFormats.RGB | ColorFormats.RGBA | ColorFormats.HSL | ColorFormats.HSLA | ColorFormats.HSV | ColorFormats.HSVA | tinycolorInstance + declare module 'tinycolor2' { export = tinycolor; -} +} \ No newline at end of file