From def0bc91b3e9606a87b6066aa2f62e4f992949b2 Mon Sep 17 00:00:00 2001 From: feitzi Date: Tue, 20 Sep 2016 19:28:57 +0200 Subject: [PATCH] added string unions for luminosity, hue, format Hue can also be a number --- randomcolor/randomColor.d.ts | 29 ++++++++--------------------- randomcolor/randomcolor.d.ts | 29 ++++++++--------------------- 2 files changed, 16 insertions(+), 42 deletions(-) diff --git a/randomcolor/randomColor.d.ts b/randomcolor/randomColor.d.ts index a92af51453..4c85f12da5 100644 --- a/randomcolor/randomColor.d.ts +++ b/randomcolor/randomColor.d.ts @@ -3,26 +3,13 @@ // Definitions by: Mathias Feitzinger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace RandomColor { - interface RandomColorStatic { +declare function randomColor(options?: RandomColorOptions): string; - () : string; - - (options : randomColorOptions): string; -} - -interface randomColorOptions { - hue? : string; - luminosity? : string; - count? : string | number; - seed?: string; - format?: string; - } -} - -declare var randomColor: RandomColor.RandomColorStatic; - -declare module 'randomcolor' { - export = randomColor; -} \ No newline at end of file +interface RandomColorOptions { + hue? : number | "red" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "monochrome" | "random"; + luminosity? : "bright" | "light" | "dark" | "random"; + count? : number; + seed?: number | string; + format?: "hsvArray" | "hslArray" | "hsl" | "hsla" | "rgbArray"| "rgb"| "rgba"| "hex"; + } \ No newline at end of file diff --git a/randomcolor/randomcolor.d.ts b/randomcolor/randomcolor.d.ts index a92af51453..4c85f12da5 100644 --- a/randomcolor/randomcolor.d.ts +++ b/randomcolor/randomcolor.d.ts @@ -3,26 +3,13 @@ // Definitions by: Mathias Feitzinger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace RandomColor { - interface RandomColorStatic { +declare function randomColor(options?: RandomColorOptions): string; - () : string; - - (options : randomColorOptions): string; -} - -interface randomColorOptions { - hue? : string; - luminosity? : string; - count? : string | number; - seed?: string; - format?: string; - } -} - -declare var randomColor: RandomColor.RandomColorStatic; - -declare module 'randomcolor' { - export = randomColor; -} \ No newline at end of file +interface RandomColorOptions { + hue? : number | "red" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "monochrome" | "random"; + luminosity? : "bright" | "light" | "dark" | "random"; + count? : number; + seed?: number | string; + format?: "hsvArray" | "hslArray" | "hsl" | "hsla" | "rgbArray"| "rgb"| "rgba"| "hex"; + } \ No newline at end of file