From 3dc3b0af3e0e7b99c788cc4e16e45ecf2f9eb9f5 Mon Sep 17 00:00:00 2001 From: vincentvade Date: Sun, 29 Oct 2023 14:18:34 +0100 Subject: [PATCH 1/3] Add types typescript --- package.json | 1 + types/index.d.ts | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 types/index.d.ts diff --git a/package.json b/package.json index c1a8866..556f6cf 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "3.0.1", "description": "Get the contrast ratio and WCAG score between common CSS color types.", "main": "index.js", + "types": "types/index.d.ts", "files": [ "cli.js", "index.js" diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..47d5c48 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,8 @@ +type Option = { + ignoreAlpha: boolean +} + +export function ratio(colorOne: string, colorTwo: string, options?: Option): string +export function score(colorOne: string, colorTwo: string, options?: Option): string +export function isAccessible(colorOne: string, colorTwo: string, options?: Option): boolean +export function isNotTransparent(color: string, options?: Option): boolean \ No newline at end of file From 0a6b9131dd7e851fa3adee9e63537629ff97e560 Mon Sep 17 00:00:00 2001 From: vincentvade Date: Sun, 29 Oct 2023 14:19:28 +0100 Subject: [PATCH 2/3] Add EOF --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 47d5c48..344946d 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -5,4 +5,4 @@ type Option = { export function ratio(colorOne: string, colorTwo: string, options?: Option): string export function score(colorOne: string, colorTwo: string, options?: Option): string export function isAccessible(colorOne: string, colorTwo: string, options?: Option): boolean -export function isNotTransparent(color: string, options?: Option): boolean \ No newline at end of file +export function isNotTransparent(color: string, options?: Option): boolean From 9a31341824702e4acb29efb4a01a5c8b4b8aaa77 Mon Sep 17 00:00:00 2001 From: vincentvade Date: Sun, 29 Oct 2023 14:24:15 +0100 Subject: [PATCH 3/3] Add return type string isNotTransparent --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 344946d..66bc971 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -5,4 +5,4 @@ type Option = { export function ratio(colorOne: string, colorTwo: string, options?: Option): string export function score(colorOne: string, colorTwo: string, options?: Option): string export function isAccessible(colorOne: string, colorTwo: string, options?: Option): boolean -export function isNotTransparent(color: string, options?: Option): boolean +export function isNotTransparent(color: string, options?: Option): string