From 1b803f972a8edfcd8341520f195e7354fa091ec2 Mon Sep 17 00:00:00 2001 From: feitzi Date: Fri, 16 Sep 2016 12:49:30 +0200 Subject: [PATCH 1/9] Added definition file for randomColor --- randomColor/randomColor-tests.ts | 2 ++ randomColor/randomColor.d.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 randomColor/randomColor-tests.ts create mode 100644 randomColor/randomColor.d.ts diff --git a/randomColor/randomColor-tests.ts b/randomColor/randomColor-tests.ts new file mode 100644 index 0000000000..274768ebc1 --- /dev/null +++ b/randomColor/randomColor-tests.ts @@ -0,0 +1,2 @@ +/// + diff --git a/randomColor/randomColor.d.ts b/randomColor/randomColor.d.ts new file mode 100644 index 0000000000..e439e2d77d --- /dev/null +++ b/randomColor/randomColor.d.ts @@ -0,0 +1,30 @@ +// Type definitions for randomColor 0.4.1 +// Project: https://github.com/davidmerfield/randomColor +// Definitions by: Mathias Feitzinger +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace RandomColor { + + interface RandomColorStatic { + + () : string; + + (options : randomColorOptions): string; + +} + +interface randomColorOptions { + hue? : string; + luminosity? : string; + count? : string; + seed?: string; + format?: string; + } +} + + +declare var randomColor: RandomColor.RandomColorStatic; + +declare module 'randomColor' { + export = randomColor; +} \ No newline at end of file From 300d30753459bbd6fe6b53b61e44e21e3669fc97 Mon Sep 17 00:00:00 2001 From: feitzi Date: Fri, 16 Sep 2016 12:58:59 +0200 Subject: [PATCH 2/9] added test for randomColor --- randomColor/randomColor-tests.ts | 38 ++++++++++++++++++++++++++++++++ randomColor/randomColor.d.ts | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/randomColor/randomColor-tests.ts b/randomColor/randomColor-tests.ts index 274768ebc1..69b617615e 100644 --- a/randomColor/randomColor-tests.ts +++ b/randomColor/randomColor-tests.ts @@ -1,2 +1,40 @@ /// +// Returns a hex code for an attractive color +randomColor(); + +// Returns an array of ten green colors +randomColor({ + count: 10, + hue: 'green' +}); + +// Returns a hex code for a light blue +randomColor({ + luminosity: 'light', + hue: 'blue' +}); + +// Returns a hex code for a 'truly random' color +randomColor({ + luminosity: 'random', + hue: 'random' +}); + +// Returns a bright color in RGB +randomColor({ + luminosity: 'bright', + format: 'rgb' // e.g. 'rgb(225,200,20)' +}); + +// Returns a dark RGB color with random alpha +randomColor({ + luminosity: 'dark', + format: 'rgba' // e.g. 'rgba(9, 1, 107, 0.6482447960879654)' +}); + +// Returns a light HSL color with random alpha +randomColor({ + luminosity: 'light', + format: 'hsla' // e.g. 'hsla(27, 88.99%, 81.83%, 0.6450211517512798)' +}); \ No newline at end of file diff --git a/randomColor/randomColor.d.ts b/randomColor/randomColor.d.ts index e439e2d77d..81f43a0228 100644 --- a/randomColor/randomColor.d.ts +++ b/randomColor/randomColor.d.ts @@ -16,7 +16,7 @@ declare namespace RandomColor { interface randomColorOptions { hue? : string; luminosity? : string; - count? : string; + count? : string | number; seed?: string; format?: string; } From 1175068a71da6baf10fffaf08df4fa8c32ebb6a9 Mon Sep 17 00:00:00 2001 From: feitzi Date: Fri, 16 Sep 2016 13:14:08 +0200 Subject: [PATCH 3/9] styling for randomColor --- randomColor/randomColor.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/randomColor/randomColor.d.ts b/randomColor/randomColor.d.ts index 81f43a0228..1c52f39be1 100644 --- a/randomColor/randomColor.d.ts +++ b/randomColor/randomColor.d.ts @@ -10,7 +10,6 @@ declare namespace RandomColor { () : string; (options : randomColorOptions): string; - } interface randomColorOptions { @@ -22,7 +21,6 @@ interface randomColorOptions { } } - declare var randomColor: RandomColor.RandomColorStatic; declare module 'randomColor' { From 2ff803ff9187fc4837a79924435f2d98f8a3bdda Mon Sep 17 00:00:00 2001 From: feitzi Date: Mon, 19 Sep 2016 20:14:41 +0200 Subject: [PATCH 4/9] refactored: randomColor to randomcolor --- randomColor/randomColor.d.ts | 2 +- randomcolor/randomcolor-tests.ts | 40 ++++++++++++++++++++++++++++++++ randomcolor/randomcolor.d.ts | 28 ++++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 randomcolor/randomcolor-tests.ts create mode 100644 randomcolor/randomcolor.d.ts diff --git a/randomColor/randomColor.d.ts b/randomColor/randomColor.d.ts index 1c52f39be1..a92af51453 100644 --- a/randomColor/randomColor.d.ts +++ b/randomColor/randomColor.d.ts @@ -23,6 +23,6 @@ interface randomColorOptions { declare var randomColor: RandomColor.RandomColorStatic; -declare module 'randomColor' { +declare module 'randomcolor' { export = randomColor; } \ No newline at end of file diff --git a/randomcolor/randomcolor-tests.ts b/randomcolor/randomcolor-tests.ts new file mode 100644 index 0000000000..69b617615e --- /dev/null +++ b/randomcolor/randomcolor-tests.ts @@ -0,0 +1,40 @@ +/// + +// Returns a hex code for an attractive color +randomColor(); + +// Returns an array of ten green colors +randomColor({ + count: 10, + hue: 'green' +}); + +// Returns a hex code for a light blue +randomColor({ + luminosity: 'light', + hue: 'blue' +}); + +// Returns a hex code for a 'truly random' color +randomColor({ + luminosity: 'random', + hue: 'random' +}); + +// Returns a bright color in RGB +randomColor({ + luminosity: 'bright', + format: 'rgb' // e.g. 'rgb(225,200,20)' +}); + +// Returns a dark RGB color with random alpha +randomColor({ + luminosity: 'dark', + format: 'rgba' // e.g. 'rgba(9, 1, 107, 0.6482447960879654)' +}); + +// Returns a light HSL color with random alpha +randomColor({ + luminosity: 'light', + format: 'hsla' // e.g. 'hsla(27, 88.99%, 81.83%, 0.6450211517512798)' +}); \ No newline at end of file diff --git a/randomcolor/randomcolor.d.ts b/randomcolor/randomcolor.d.ts new file mode 100644 index 0000000000..a92af51453 --- /dev/null +++ b/randomcolor/randomcolor.d.ts @@ -0,0 +1,28 @@ +// Type definitions for randomColor 0.4.1 +// Project: https://github.com/davidmerfield/randomColor +// Definitions by: Mathias Feitzinger +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace RandomColor { + + interface RandomColorStatic { + + () : 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 From 8571feee2f68b8971ee02acbe60021d368ba4136 Mon Sep 17 00:00:00 2001 From: feitzi Date: Mon, 19 Sep 2016 20:18:33 +0200 Subject: [PATCH 5/9] fixed wrong reference path --- randomColor/randomColor-tests.ts | 2 +- randomcolor/randomcolor-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/randomColor/randomColor-tests.ts b/randomColor/randomColor-tests.ts index 69b617615e..4dfd6bed26 100644 --- a/randomColor/randomColor-tests.ts +++ b/randomColor/randomColor-tests.ts @@ -1,4 +1,4 @@ -/// +/// // Returns a hex code for an attractive color randomColor(); diff --git a/randomcolor/randomcolor-tests.ts b/randomcolor/randomcolor-tests.ts index 69b617615e..4dfd6bed26 100644 --- a/randomcolor/randomcolor-tests.ts +++ b/randomcolor/randomcolor-tests.ts @@ -1,4 +1,4 @@ -/// +/// // Returns a hex code for an attractive color randomColor(); From 24c81fd722b734b793ea7acd7aca0fddebe47c71 Mon Sep 17 00:00:00 2001 From: feitzi Date: Mon, 19 Sep 2016 20:36:32 +0200 Subject: [PATCH 6/9] fixed renaming folder --- {randomColor => randomcolor}/randomColor-tests.ts | 0 {randomColor => randomcolor}/randomColor.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {randomColor => randomcolor}/randomColor-tests.ts (100%) rename {randomColor => randomcolor}/randomColor.d.ts (100%) diff --git a/randomColor/randomColor-tests.ts b/randomcolor/randomColor-tests.ts similarity index 100% rename from randomColor/randomColor-tests.ts rename to randomcolor/randomColor-tests.ts diff --git a/randomColor/randomColor.d.ts b/randomcolor/randomColor.d.ts similarity index 100% rename from randomColor/randomColor.d.ts rename to randomcolor/randomColor.d.ts From def0bc91b3e9606a87b6066aa2f62e4f992949b2 Mon Sep 17 00:00:00 2001 From: feitzi Date: Tue, 20 Sep 2016 19:28:57 +0200 Subject: [PATCH 7/9] 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 From 672f5fb494dde886e032aab72575c5fd38b3a16a Mon Sep 17 00:00:00 2001 From: feitzi Date: Tue, 20 Sep 2016 19:55:30 +0200 Subject: [PATCH 8/9] removed randomColor (windows casesensitive problem) --- randomcolor/randomColor-tests.ts | 40 -------------------------------- randomcolor/randomColor.d.ts | 15 ------------ 2 files changed, 55 deletions(-) delete mode 100644 randomcolor/randomColor-tests.ts delete mode 100644 randomcolor/randomColor.d.ts diff --git a/randomcolor/randomColor-tests.ts b/randomcolor/randomColor-tests.ts deleted file mode 100644 index 4dfd6bed26..0000000000 --- a/randomcolor/randomColor-tests.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -// Returns a hex code for an attractive color -randomColor(); - -// Returns an array of ten green colors -randomColor({ - count: 10, - hue: 'green' -}); - -// Returns a hex code for a light blue -randomColor({ - luminosity: 'light', - hue: 'blue' -}); - -// Returns a hex code for a 'truly random' color -randomColor({ - luminosity: 'random', - hue: 'random' -}); - -// Returns a bright color in RGB -randomColor({ - luminosity: 'bright', - format: 'rgb' // e.g. 'rgb(225,200,20)' -}); - -// Returns a dark RGB color with random alpha -randomColor({ - luminosity: 'dark', - format: 'rgba' // e.g. 'rgba(9, 1, 107, 0.6482447960879654)' -}); - -// Returns a light HSL color with random alpha -randomColor({ - luminosity: 'light', - format: 'hsla' // e.g. 'hsla(27, 88.99%, 81.83%, 0.6450211517512798)' -}); \ No newline at end of file diff --git a/randomcolor/randomColor.d.ts b/randomcolor/randomColor.d.ts deleted file mode 100644 index 4c85f12da5..0000000000 --- a/randomcolor/randomColor.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Type definitions for randomColor 0.4.1 -// Project: https://github.com/davidmerfield/randomColor -// Definitions by: Mathias Feitzinger -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare function randomColor(options?: RandomColorOptions): string; - -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 From fba7aad83ba9bdedeccf282094c759918a829b1c Mon Sep 17 00:00:00 2001 From: feitzi Date: Tue, 20 Sep 2016 20:01:18 +0200 Subject: [PATCH 9/9] consistently indentations --- randomcolor/randomcolor-tests.ts | 26 +++++++++++++------------- randomcolor/randomcolor.d.ts | 13 ++++++------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/randomcolor/randomcolor-tests.ts b/randomcolor/randomcolor-tests.ts index 4dfd6bed26..9c72892e78 100644 --- a/randomcolor/randomcolor-tests.ts +++ b/randomcolor/randomcolor-tests.ts @@ -1,40 +1,40 @@ /// // Returns a hex code for an attractive color -randomColor(); +randomColor(); // Returns an array of ten green colors randomColor({ - count: 10, - hue: 'green' + count: 10, + hue: 'green' }); // Returns a hex code for a light blue randomColor({ - luminosity: 'light', - hue: 'blue' + luminosity: 'light', + hue: 'blue' }); // Returns a hex code for a 'truly random' color randomColor({ - luminosity: 'random', - hue: 'random' + luminosity: 'random', + hue: 'random' }); // Returns a bright color in RGB randomColor({ - luminosity: 'bright', - format: 'rgb' // e.g. 'rgb(225,200,20)' + luminosity: 'bright', + format: 'rgb' // e.g. 'rgb(225,200,20)' }); // Returns a dark RGB color with random alpha randomColor({ - luminosity: 'dark', - format: 'rgba' // e.g. 'rgba(9, 1, 107, 0.6482447960879654)' + luminosity: 'dark', + format: 'rgba' // e.g. 'rgba(9, 1, 107, 0.6482447960879654)' }); // Returns a light HSL color with random alpha randomColor({ - luminosity: 'light', - format: 'hsla' // e.g. 'hsla(27, 88.99%, 81.83%, 0.6450211517512798)' + luminosity: 'light', + format: 'hsla' // e.g. 'hsla(27, 88.99%, 81.83%, 0.6450211517512798)' }); \ No newline at end of file diff --git a/randomcolor/randomcolor.d.ts b/randomcolor/randomcolor.d.ts index 4c85f12da5..1886e38a09 100644 --- a/randomcolor/randomcolor.d.ts +++ b/randomcolor/randomcolor.d.ts @@ -3,13 +3,12 @@ // Definitions by: Mathias Feitzinger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare function randomColor(options?: RandomColorOptions): string; 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 + 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