From f54e986c0d8622b4175092f6a224828661ad2a55 Mon Sep 17 00:00:00 2001 From: Shogo Iwano Date: Sat, 29 Aug 2020 01:29:01 +0900 Subject: [PATCH] Add TypeScript declaration file --- package.json | 1 + src/index.d.ts | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/index.d.ts diff --git a/package.json b/package.json index 1326e5a..f2e0883 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Generate unique and beautiful colors from any texts or numbers", "author": "Rasool Dastoori", "main": "dist/uniqolor.js", + "types": "src/index.d.ts", "keywords": [ "uniqolor", "uniqcolor", diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..c57cdef --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,21 @@ +declare module "uniqolor" { + interface Options { + format?: "rgb" | "hsl" | "hex"; + saturation?: number | number[]; + lightness?: number | number[]; + differencePoint?: number; + } + + interface Color { + color: string; + isLight: boolean; + } + + interface Uniqolor { + (value: string | number, options?: Options): Color; + random: (options?: Options) => Color; + } + + const uniqolor: Uniqolor; + export = uniqolor; +}