From 9434956cf65993b2b624db6baa608b6cf09fb5b3 Mon Sep 17 00:00:00 2001 From: LitoMore Date: Fri, 7 Feb 2025 21:52:13 +0800 Subject: [PATCH] fix type definitions --- index.d.ts | 492 ++++++++++++++++++++++++++++++++++++++++++++++++ index.test-d.ts | 272 ++++++++++++++++++++++++++ 2 files changed, 764 insertions(+) diff --git a/index.d.ts b/index.d.ts index d04a625..5feca1d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -15,6 +15,437 @@ export type ANSI256 = number; export type Keyword = string; export type HEX = string; +declare namespace route { + type rgb = { + hsl(from: RGB): HSL; + hsl(...from: RGB): HSL; + hsl(from: RGB): HSL; + hsl(...from: RGB): HSL; + hsv(from: RGB): HSV; + hsv(...from: RGB): HSV; + hwb(from: RGB): HWB; + hwb(...from: RGB): HWB; + cmyk(from: RGB): CMYK; + cmyk(...from: RGB): CMYK; + xyz(from: RGB): XYZ; + xyz(...from: RGB): XYZ; + lab(from: RGB): LAB; + lab(...from: RGB): LAB; + lch(from: RGB): LCH; + lch(...from: RGB): LCH; + hex(from: RGB): HEX; + hex(...from: RGB): HEX; + keyword(from: RGB): Keyword; + keyword(...from: RGB): Keyword; + ansi16(from: RGB): ANSI16; + ansi16(...from: RGB): ANSI16; + ansi256(from: RGB): ANSI256; + ansi256(...from: RGB): ANSI256; + hcg(from: RGB): HCG; + hcg(...from: RGB): HCG; + apple(from: RGB): Apple; + apple(...from: RGB): Apple; + gray(from: RGB): Gray; + gray(...from: RGB): Gray; + }; + + type hsl = { + rgb(from: HSL): RGB; + rgb(...from: HSL): RGB; + hsv(from: HSL): HSV; + hsv(...from: HSL): HSV; + hwb(from: HSL): HWB; + hwb(...from: HSL): HWB; + cmyk(from: HSL): CMYK; + cmyk(...from: HSL): CMYK; + xyz(from: HSL): XYZ; + xyz(...from: HSL): XYZ; + lab(from: HSL): LAB; + lab(...from: HSL): LAB; + lch(from: HSL): LCH; + lch(...from: HSL): LCH; + hex(from: HSL): HEX; + hex(...from: HSL): HEX; + keyword(from: HSL): Keyword; + keyword(...from: HSL): Keyword; + ansi16(from: HSL): ANSI16; + ansi16(...from: HSL): ANSI16; + ansi256(from: HSL): ANSI256; + ansi256(...from: HSL): ANSI256; + hcg(from: HSL): HCG; + hcg(...from: HSL): HCG; + apple(from: HSL): Apple; + apple(...from: HSL): Apple; + gray(from: HSL): Gray; + gray(...from: HSL): Gray; + }; + + type hsv = { + rgb(from: HSV): RGB; + rgb(...from: HSV): RGB; + hsl(from: HSV): HSL; + hsl(...from: HSV): HSL; + hwb(from: HSV): HWB; + hwb(...from: HSV): HWB; + cmyk(from: HSV): CMYK; + cmyk(...from: HSV): CMYK; + xyz(from: HSV): XYZ; + xyz(...from: HSV): XYZ; + lab(from: HSV): LAB; + lab(...from: HSV): LAB; + lch(from: HSV): LCH; + lch(...from: HSV): LCH; + hex(from: HSV): HEX; + hex(...from: HSV): HEX; + keyword(from: HSV): Keyword; + keyword(...from: HSV): Keyword; + ansi16(from: HSV): ANSI16; + ansi16(...from: HSV): ANSI16; + ansi256(from: HSV): ANSI256; + ansi256(...from: HSV): ANSI256; + hcg(from: HSV): HCG; + hcg(...from: HSV): HCG; + apple(from: HSV): Apple; + apple(...from: HSV): Apple; + gray(from: HSV): Gray; + gray(...from: HSV): Gray; + }; + + type hwb = { + rgb(from: HWB): RGB; + rgb(...from: HWB): RGB; + hsl(from: HWB): HSL; + hsl(...from: HWB): HSL; + hsv(from: HWB): HSV; + hsv(...from: HWB): HSV; + cmyk(from: HWB): CMYK; + cmyk(...from: HWB): CMYK; + xyz(from: HWB): XYZ; + xyz(...from: HWB): XYZ; + lab(from: HWB): LAB; + lab(...from: HWB): LAB; + lch(from: HWB): LCH; + lch(...from: HWB): LCH; + hex(from: HWB): HEX; + hex(...from: HWB): HEX; + keyword(from: HWB): Keyword; + keyword(...from: HWB): Keyword; + ansi16(from: HWB): ANSI16; + ansi16(...from: HWB): ANSI16; + ansi256(from: HWB): ANSI256; + ansi256(...from: HWB): ANSI256; + hcg(from: HWB): HCG; + hcg(...from: HWB): HCG; + apple(from: HWB): Apple; + apple(...from: HWB): Apple; + gray(from: HWB): Gray; + gray(...from: HWB): Gray; + + }; + + type cmyk = { + rgb(from: CMYK): RGB; + rgb(...from: CMYK): RGB; + hsl(from: CMYK): HSL; + hsl(...from: CMYK): HSL; + hsv(from: CMYK): HSV; + hsv(...from: CMYK): HSV; + hwb(from: CMYK): HWB; + hwb(...from: CMYK): HWB; + xyz(from: CMYK): XYZ; + xyz(...from: CMYK): XYZ; + lab(from: CMYK): LAB; + lab(...from: CMYK): LAB; + lch(from: CMYK): LCH; + lch(...from: CMYK): LCH; + hex(from: CMYK): HEX; + hex(...from: CMYK): HEX; + keyword(from: CMYK): Keyword; + keyword(...from: CMYK): Keyword; + ansi16(from: CMYK): ANSI16; + ansi16(...from: CMYK): ANSI16; + ansi256(from: CMYK): ANSI256; + ansi256(...from: CMYK): ANSI256; + hcg(from: CMYK): HCG; + hcg(...from: CMYK): HCG; + apple(from: CMYK): Apple; + apple(...from: CMYK): Apple; + gray(from: CMYK): Gray; + gray(...from: CMYK): Gray; + }; + + type xyz = { + rgb(from: XYZ): RGB; + rgb(...from: XYZ): RGB; + hsl(from: XYZ): HSL; + hsl(...from: XYZ): HSL; + hsv(from: XYZ): HSV; + hsv(...from: XYZ): HSV; + hwb(from: XYZ): HWB; + hwb(...from: XYZ): HWB; + cmyk(from: XYZ): CMYK; + cmyk(...from: XYZ): CMYK; + lab(from: XYZ): LAB; + lab(...from: XYZ): LAB; + lch(from: XYZ): LCH; + lch(...from: XYZ): LCH; + hex(from: XYZ): HEX; + hex(...from: XYZ): HEX; + keyword(from: XYZ): Keyword; + keyword(...from: XYZ): Keyword; + ansi16(from: XYZ): ANSI16; + ansi16(...from: XYZ): ANSI16; + ansi256(from: XYZ): ANSI256; + ansi256(...from: XYZ): ANSI256; + hcg(from: XYZ): HCG; + hcg(...from: XYZ): HCG; + apple(from: XYZ): Apple; + apple(...from: XYZ): Apple; + gray(from: XYZ): Gray; + gray(...from: XYZ): Gray; + }; + + type lab = { + rgb(from: LAB): RGB; + rgb(...from: LAB): RGB; + hsl(from: LAB): HSL; + hsl(...from: LAB): HSL; + hsv(from: LAB): HSV; + hsv(...from: LAB): HSV; + hwb(from: LAB): HWB; + hwb(...from: LAB): HWB; + cmyk(from: LAB): CMYK; + cmyk(...from: LAB): CMYK; + xyz(from: LAB): XYZ; + xyz(...from: LAB): XYZ; + lch(from: LAB): LCH; + lch(...from: LAB): LCH; + hex(from: LAB): HEX; + hex(...from: LAB): HEX; + keyword(from: LAB): Keyword; + keyword(...from: LAB): Keyword; + ansi16(from: LAB): ANSI16; + ansi16(...from: LAB): ANSI16; + ansi256(from: LAB): ANSI256; + ansi256(...from: LAB): ANSI256; + hcg(from: LAB): HCG; + hcg(...from: LAB): HCG; + apple(from: LAB): Apple; + apple(...from: LAB): Apple; + gray(from: LAB): Gray; + gray(...from: LAB): Gray; + }; + + type lch = { + rgb(from: LCH): RGB; + rgb(...from: LCH): RGB; + hsl(from: LCH): HSL; + hsl(...from: LCH): HSL; + hsv(from: LCH): HSV; + hsv(...from: LCH): HSV; + hwb(from: LCH): HWB; + hwb(...from: LCH): HWB; + cmyk(from: LCH): CMYK; + cmyk(...from: LCH): CMYK; + xyz(from: LCH): XYZ; + xyz(...from: LCH): XYZ; + lab(from: LCH): LAB; + lab(...from: LCH): LAB; + hex(from: LCH): HEX; + hex(...from: LCH): HEX; + keyword(from: LCH): Keyword; + keyword(...from: LCH): Keyword; + ansi16(from: LCH): ANSI16; + ansi16(...from: LCH): ANSI16; + ansi256(from: LCH): ANSI256; + ansi256(...from: LCH): ANSI256; + hcg(from: LCH): HCG; + hcg(...from: LCH): HCG; + apple(from: LCH): Apple; + apple(...from: LCH): Apple; + gray(from: LCH): Gray; + gray(...from: LCH): Gray; + }; + + type hex = { + rgb(from: HEX): RGB; + hsl(from: HEX): HSL; + hsv(from: HEX): HSV; + hwb(from: HEX): HWB; + cmyk(from: HEX): CMYK; + xyz(from: HEX): XYZ; + lab(from: HEX): LAB; + lch(from: HEX): LCH; + keyword(from: HEX): Keyword; + ansi16(from: HEX): ANSI16; + ansi256(from: HEX): ANSI256; + hcg(from: HEX): HCG; + apple(from: HEX): Apple; + gray(from: HEX): Gray; + }; + + type keyword = { + rgb(from: Keyword): RGB; + hsl(from: Keyword): HSL; + hsv(from: Keyword): HSV; + hwb(from: Keyword): HWB; + cmyk(from: Keyword): CMYK; + xyz(from: Keyword): XYZ; + lab(from: Keyword): LAB; + lch(from: Keyword): LCH; + hex(from: Keyword): HEX; + ansi16(from: Keyword): ANSI16; + ansi256(from: Keyword): ANSI256; + hcg(from: Keyword): HCG; + apple(from: Keyword): Apple; + gray(from: Keyword): Gray; + }; + + type ansi16 = { + rgb(from: ANSI16): RGB; + hsl(from: ANSI16): HSL; + hsv(from: ANSI16): HSV; + hwb(from: ANSI16): HWB; + cmyk(from: ANSI16): CMYK; + xyz(from: ANSI16): XYZ; + lab(from: ANSI16): LAB; + lch(from: ANSI16): LCH; + hex(from: ANSI16): HEX; + keyword(from: ANSI16): Keyword; + ansi256(from: ANSI16): ANSI256; + hcg(from: ANSI16): HCG; + apple(from: ANSI16): Apple; + gray(from: ANSI16): Gray; + }; + + type ansi256 = { + rgb(from: ANSI256): RGB; + hsl(from: ANSI256): HSL; + hsv(from: ANSI256): HSV; + hwb(from: ANSI256): HWB; + cmyk(from: ANSI256): CMYK; + xyz(from: ANSI256): XYZ; + lab(from: ANSI256): LAB; + lch(from: ANSI256): LCH; + hex(from: ANSI256): HEX; + keyword(from: ANSI256): Keyword; + ansi16(from: ANSI256): ANSI16; + hcg(from: ANSI256): HCG; + apple(from: ANSI256): Apple; + gray(from: ANSI256): Gray; + }; + + type hcg = { + rgb(from: HCG): RGB; + rgb(...from: HCG): RGB; + hsl(from: HCG): HSL; + hsl(...from: HCG): HSL; + hsv(from: HCG): HSV; + hsv(...from: HCG): HSV; + hwb(from: HCG): HWB; + hwb(...from: HCG): HWB; + cmyk(from: HCG): CMYK; + cmyk(...from: HCG): CMYK; + xyz(from: HCG): XYZ; + xyz(...from: HCG): XYZ; + lab(from: HCG): LAB; + lab(...from: HCG): LAB; + lch(from: HCG): LCH; + lch(...from: HCG): LCH; + hex(from: HCG): HEX; + hex(...from: HCG): HEX; + keyword(from: HCG): Keyword; + keyword(...from: HCG): Keyword; + ansi16(from: HCG): ANSI16; + ansi16(...from: HCG): ANSI16; + ansi256(from: HCG): ANSI256; + ansi256(...from: HCG): ANSI256; + apple(from: HCG): Apple; + apple(...from: HCG): Apple; + gray(from: HCG): Gray; + gray(...from: HCG): Gray; + + }; + + type apple = { + rgb(from: Apple): RGB; + rgb(...from: Apple): RGB; + hsl(from: Apple): HSL; + hsl(...from: Apple): HSL; + hsv(from: Apple): HSV; + hsv(...from: Apple): HSV; + hwb(from: Apple): HWB; + hwb(...from: Apple): HWB; + cmyk(from: Apple): CMYK; + cmyk(...from: Apple): CMYK; + xyz(from: Apple): XYZ; + xyz(...from: Apple): XYZ; + lab(from: Apple): LAB; + lab(...from: Apple): LAB; + lch(from: Apple): LCH; + lch(...from: Apple): LCH; + hex(from: Apple): HEX; + hex(...from: Apple): HEX; + keyword(from: Apple): Keyword; + keyword(...from: Apple): Keyword; + ansi16(from: Apple): ANSI16; + ansi16(...from: Apple): ANSI16; + ansi256(from: Apple): ANSI256; + ansi256(...from: Apple): ANSI256; + hcg(from: Apple): HCG; + hcg(...from: Apple): HCG; + gray(from: Apple): Gray; + gray(...from: Apple): Gray; + }; + + type gray = { + rgb(from: Gray): RGB; + rgb(...from: Gray): RGB; + hsl(from: Gray): HSL; + hsl(...from: Gray): HSL; + hsv(from: Gray): HSV; + hsv(...from: Gray): HSV; + hwb(from: Gray): HWB; + hwb(...from: Gray): HWB; + cmyk(from: Gray): CMYK; + cmyk(...from: Gray): CMYK; + xyz(from: Gray): XYZ; + xyz(...from: Gray): XYZ; + lab(from: Gray): LAB; + lab(...from: Gray): LAB; + lch(from: Gray): LCH; + lch(...from: Gray): LCH; + hex(from: Gray): HEX; + hex(...from: Gray): HEX; + keyword(from: Gray): Keyword; + keyword(...from: Gray): Keyword; + ansi16(from: Gray): ANSI16; + ansi16(...from: Gray): ANSI16; + ansi256(from: Gray): ANSI256; + ansi256(...from: Gray): ANSI256; + hcg(from: Gray): HCG; + hcg(...from: Gray): HCG; + apple(from: Gray): Apple; + apple(...from: Gray): Apple; + }; +} + +declare function route(fromModel: 'rgb'): route.rgb; +declare function route(fromModel: 'hsl'): route.hsl; +declare function route(fromModel: 'hsv'): route.hsv; +declare function route(fromModel: 'hwb'): route.hwb; +declare function route(fromModel: 'cmyk'): route.cmyk; +declare function route(fromModel: 'xyz'): route.xyz; +declare function route(fromModel: 'lab'): route.lab; +declare function route(fromModel: 'lch'): route.lch; +declare function route(fromModel: 'hex'): route.hex; +declare function route(fromModel: 'keyword'): route.keyword; +declare function route(fromModel: 'ansi16'): route.ansi16; +declare function route(fromModel: 'ansi256'): route.ansi256; +declare function route(fromModel: 'hcg'): route.hcg; +declare function route(fromModel: 'apple'): route.apple; +declare function route(fromModel: 'gray'): route.gray; + export type Convert = { rgb: { channels: Channels; @@ -63,12 +494,21 @@ export type Convert = { (...rgb: RGB): Gray; raw: (...rgb: RGB) => Gray; }; + } & route.rgb & { + [F in keyof route.rgb]: { + raw: route.rgb[F]; + }; }; keyword: { + channels: Channels; rgb: { (keyword: Keyword): RGB; raw: (keyword: Keyword) => RGB; }; + } & route.keyword & { + [F in keyof route.keyword]: { + raw: route.keyword[F]; + }; }; hsl: { channels: Channels; @@ -85,6 +525,10 @@ export type Convert = { (...hsl: HSL): HCG; raw: (...hsl: HSL) => HCG; }; + } & route.hsl & { + [F in keyof route.hsl]: { + raw: route.hsl[F]; + }; }; hsv: { channels: Channels; @@ -113,6 +557,10 @@ export type Convert = { (...hsv: HSV): ANSI16; raw: (...hsv: HSV) => ANSI16; }; + } & route.hsv & { + [F in keyof route.hsv]: { + raw: route.hsv[F]; + }; }; hwb: { channels: Channels; @@ -125,6 +573,10 @@ export type Convert = { (...hwb: HWB): RGB; raw: (...hwb: HWB) => RGB; }; + } & route.hwb & { + [F in keyof route.hwb]: { + raw: route.hwb[F]; + }; }; cmyk: { channels: Channels; @@ -133,6 +585,10 @@ export type Convert = { (...cmyk: CMYK): RGB; raw: (...cmyk: CMYK) => RGB; }; + } & route.cmyk & { + [F in keyof route.cmyk]: { + raw: route.cmyk[F]; + }; }; xyz: { channels: Channels; @@ -145,6 +601,10 @@ export type Convert = { (...xyz: XYZ): LAB; raw: (...xyz: XYZ) => LAB; }; + } & route.xyz & { + [F in keyof route.xyz]: { + raw: route.xyz[F]; + }; }; lab: { channels: Channels; @@ -157,6 +617,10 @@ export type Convert = { (...lab: LAB): LCH; raw: (...lab: LAB) => LCH; }; + } & route.lab & { + [F in keyof route.lab]: { + raw: route.lab[F]; + }; }; lch: { channels: Channels; @@ -165,6 +629,10 @@ export type Convert = { (...lch: LCH): LAB; raw: (...lch: LCH) => LAB; }; + } & route.lch & { + [F in keyof route.lch]: { + raw: route.lch[F]; + }; }; hex: { channels: Channels; @@ -173,6 +641,10 @@ export type Convert = { (hex: HEX): RGB; raw: (hex: HEX) => RGB; }; + } & route.hex & { + [F in keyof route.hex]: { + raw: route.hex[F]; + }; }; ansi16: { channels: Channels; @@ -181,6 +653,10 @@ export type Convert = { (ansi16: ANSI16): RGB; raw: (ansi16: ANSI16) => RGB; }; + } & route.ansi16 & { + [F in keyof route.ansi16]: { + raw: route.ansi16[F]; + }; }; ansi256: { channels: Channels; @@ -189,6 +665,10 @@ export type Convert = { (ansi256: ANSI256): RGB; raw: (ansi256: ANSI256) => RGB; }; + } & route.ansi256 & { + [F in keyof route.ansi256]: { + raw: route.ansi256[F]; + }; }; hcg: { channels: Channels; @@ -205,6 +685,10 @@ export type Convert = { (...hcg: HCG): HWB; raw: (...hcg: HCG) => HWB; }; + } & route.hcg & { + [F in keyof route.hcg]: { + raw: route.hcg[F]; + }; }; apple: { channels: Channels; @@ -213,6 +697,10 @@ export type Convert = { (...apple: Apple): RGB; raw: (...apple: Apple) => RGB; }; + } & route.apple & { + [F in keyof route.apple]: { + raw: route.apple[F]; + }; }; gray: { channels: Channels; @@ -245,6 +733,10 @@ export type Convert = { (...gray: Gray): HEX; raw: (...gray: Gray) => HEX; }; + } & route.gray & { + [F in keyof route.gray]: { + raw: route.gray[F]; + }; }; }; diff --git a/index.test-d.ts b/index.test-d.ts index b7492e1..47831a9 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -25,10 +25,45 @@ expectType(convert.rgb.hex(0, 0, 0)); expectType(convert.rgb.hex.raw(0, 0, 0)); expectType(convert.rgb.gray(0, 0, 0)); expectType(convert.rgb.gray.raw(0, 0, 0)); +// - automatic conversions +expectType(convert.rgb.xyz(0, 0, 0)); +expectType(convert.rgb.xyz.raw(0, 0, 0)); +expectType(convert.rgb.lab(0, 0, 0)); +expectType(convert.rgb.lab.raw(0, 0, 0)); +expectType(convert.rgb.lch(0, 0, 0)); +expectType(convert.rgb.lch.raw(0, 0, 0)); // Keyword +expectType(convert.keyword.channels); expectType(convert.keyword.rgb('blue')); expectType(convert.keyword.rgb.raw('blue')); +// - automatic conversions +expectType(convert.keyword.hsl('blue')); +expectType(convert.keyword.hsl.raw('blue')); +expectType(convert.keyword.hsv('blue')); +expectType(convert.keyword.hsv.raw('blue')); +expectType(convert.keyword.hwb('blue')); +expectType(convert.keyword.hwb.raw('blue')); +expectType(convert.keyword.cmyk('blue')); +expectType(convert.keyword.cmyk.raw('blue')); +expectType(convert.keyword.xyz('blue')); +expectType(convert.keyword.xyz.raw('blue')); +expectType(convert.keyword.lab('blue')); +expectType(convert.keyword.lab.raw('blue')); +expectType(convert.keyword.lch('blue')); +expectType(convert.keyword.lch.raw('blue')); +expectType(convert.keyword.hex('blue')); +expectType(convert.keyword.hex.raw('blue')); +expectType(convert.keyword.ansi16('blue')); +expectType(convert.keyword.ansi16.raw('blue')); +expectType(convert.keyword.ansi256('blue')); +expectType(convert.keyword.ansi256.raw('blue')); +expectType(convert.keyword.hcg('blue')); +expectType(convert.keyword.hcg.raw('blue')); +expectType(convert.keyword.apple('blue')); +expectType(convert.keyword.apple.raw('blue')); +expectType(convert.keyword.gray('blue')); +expectType(convert.keyword.gray.raw('blue')); // HSL expectType(convert.hsl.channels); @@ -38,6 +73,29 @@ expectType(convert.hsl.hsv(0, 0, 0)); expectType(convert.hsl.hsv.raw(0, 0, 0)); expectType(convert.hsl.hcg(0, 0, 0)); expectType(convert.hsl.hcg.raw(0, 0, 0)); +// - automatic conversions +expectType(convert.hsl.hwb(0, 0, 0)); +expectType(convert.hsl.hwb.raw(0, 0, 0)); +expectType(convert.hsl.cmyk(0, 0, 0)); +expectType(convert.hsl.cmyk.raw(0, 0, 0)); +expectType(convert.hsl.xyz(0, 0, 0)); +expectType(convert.hsl.xyz.raw(0, 0, 0)); +expectType(convert.hsl.lab(0, 0, 0)); +expectType(convert.hsl.lab.raw(0, 0, 0)); +expectType(convert.hsl.lch(0, 0, 0)); +expectType(convert.hsl.lch.raw(0, 0, 0)); +expectType(convert.hsl.hex(0, 0, 0)); +expectType(convert.hsl.hex.raw(0, 0, 0)); +expectType(convert.hsl.keyword(0, 0, 0)); +expectType(convert.hsl.keyword.raw(0, 0, 0)); +expectType(convert.hsl.ansi16(0, 0, 0)); +expectType(convert.hsl.ansi16.raw(0, 0, 0)); +expectType(convert.hsl.ansi256(0, 0, 0)); +expectType(convert.hsl.ansi256.raw(0, 0, 0)); +expectType(convert.hsl.apple(0, 0, 0)); +expectType(convert.hsl.apple.raw(0, 0, 0)); +expectType(convert.hsl.gray(0, 0, 0)); +expectType(convert.hsl.gray.raw(0, 0, 0)); // HSV expectType(convert.hsv.channels); @@ -50,18 +108,90 @@ expectType(convert.hsv.hcg.raw(0, 0, 0)); expectType(convert.hsv.hwb(0, 0, 0)); expectType(convert.hsv.hwb.raw(0, 0, 0)); expectType(convert.hsv.ansi16(0, 0, 0)); +// - automatic conversions +expectType(convert.hsv.ansi16.raw(0, 0, 0)); +expectType(convert.hsv.ansi256(0, 0, 0)); +expectType(convert.hsv.ansi256.raw(0, 0, 0)); +expectType(convert.hsv.apple(0, 0, 0)); +expectType(convert.hsv.apple.raw(0, 0, 0)); +expectType(convert.hsv.gray(0, 0, 0)); +expectType(convert.hsv.gray.raw(0, 0, 0)); +expectType(convert.hsv.cmyk(0, 0, 0)); +expectType(convert.hsv.cmyk.raw(0, 0, 0)); +expectType(convert.hsv.xyz(0, 0, 0)); +expectType(convert.hsv.xyz.raw(0, 0, 0)); +expectType(convert.hsv.lab(0, 0, 0)); +expectType(convert.hsv.lab.raw(0, 0, 0)); +expectType(convert.hsv.lch(0, 0, 0)); +expectType(convert.hsv.lch.raw(0, 0, 0)); +expectType(convert.hsv.hex(0, 0, 0)); +expectType(convert.hsv.hex.raw(0, 0, 0)); +expectType(convert.hsv.keyword(0, 0, 0)); +expectType(convert.hsv.keyword.raw(0, 0, 0)); // HWB expectType(convert.hwb.channels); expectType(convert.hwb.rgb(0, 0, 0)); expectType(convert.hwb.rgb.raw(0, 0, 0)); +// - automatic conversions +expectType(convert.hwb.hsl(0, 0, 0)); +expectType(convert.hwb.hsl.raw(0, 0, 0)); +expectType(convert.hwb.hsv(0, 0, 0)); +expectType(convert.hwb.hsv.raw(0, 0, 0)); +expectType(convert.hwb.cmyk(0, 0, 0)); +expectType(convert.hwb.cmyk.raw(0, 0, 0)); +expectType(convert.hwb.xyz(0, 0, 0)); +expectType(convert.hwb.xyz.raw(0, 0, 0)); +expectType(convert.hwb.lab(0, 0, 0)); +expectType(convert.hwb.lab.raw(0, 0, 0)); +expectType(convert.hwb.lch(0, 0, 0)); +expectType(convert.hwb.lch.raw(0, 0, 0)); +expectType(convert.hwb.hex(0, 0, 0)); +expectType(convert.hwb.hex.raw(0, 0, 0)); +expectType(convert.hwb.keyword(0, 0, 0)); +expectType(convert.hwb.keyword.raw(0, 0, 0)); +expectType(convert.hwb.ansi16(0, 0, 0)); +expectType(convert.hwb.ansi16.raw(0, 0, 0)); +expectType(convert.hwb.ansi256(0, 0, 0)); +expectType(convert.hwb.ansi256.raw(0, 0, 0)); expectType(convert.hwb.hcg(0, 0, 0)); expectType(convert.hwb.hcg.raw(0, 0, 0)); +expectType(convert.hwb.apple(0, 0, 0)); +expectType(convert.hwb.apple.raw(0, 0, 0)); +expectType(convert.hwb.gray(0, 0, 0)); +expectType(convert.hwb.gray.raw(0, 0, 0)); // CMYK expectType(convert.cmyk.channels); expectType(convert.cmyk.rgb(0, 0, 0, 0)); expectType(convert.cmyk.rgb.raw(0, 0, 0, 0)); +// - automatic conversions +expectType(convert.cmyk.hsl(0, 0, 0, 0)); +expectType(convert.cmyk.hsl.raw(0, 0, 0, 0)); +expectType(convert.cmyk.hsv(0, 0, 0, 0)); +expectType(convert.cmyk.hsv.raw(0, 0, 0, 0)); +expectType(convert.cmyk.hwb(0, 0, 0, 0)); +expectType(convert.cmyk.hwb.raw(0, 0, 0, 0)); +expectType(convert.cmyk.xyz(0, 0, 0, 0)); +expectType(convert.cmyk.xyz.raw(0, 0, 0, 0)); +expectType(convert.cmyk.lab(0, 0, 0, 0)); +expectType(convert.cmyk.lab.raw(0, 0, 0, 0)); +expectType(convert.cmyk.lch(0, 0, 0, 0)); +expectType(convert.cmyk.lch.raw(0, 0, 0, 0)); +expectType(convert.cmyk.hex(0, 0, 0, 0)); +expectType(convert.cmyk.hex.raw(0, 0, 0, 0)); +expectType(convert.cmyk.keyword(0, 0, 0, 0)); +expectType(convert.cmyk.keyword.raw(0, 0, 0, 0)); +expectType(convert.cmyk.ansi16(0, 0, 0, 0)); +expectType(convert.cmyk.ansi16.raw(0, 0, 0, 0)); +expectType(convert.cmyk.ansi256(0, 0, 0, 0)); +expectType(convert.cmyk.ansi256.raw(0, 0, 0, 0)); +expectType(convert.cmyk.hcg(0, 0, 0, 0)); +expectType(convert.cmyk.hcg.raw(0, 0, 0, 0)); +expectType(convert.cmyk.apple(0, 0, 0, 0)); +expectType(convert.cmyk.apple.raw(0, 0, 0, 0)); +expectType(convert.cmyk.gray(0, 0, 0, 0)); +expectType(convert.cmyk.gray.raw(0, 0, 0, 0)); // XYZ expectType(convert.xyz.channels); @@ -69,6 +199,31 @@ expectType(convert.xyz.rgb(0, 0, 0)); expectType(convert.xyz.rgb.raw(0, 0, 0)); expectType(convert.xyz.lab(0, 0, 0)); expectType(convert.xyz.lab.raw(0, 0, 0)); +// - automatic conversions +expectType(convert.xyz.hsl(0, 0, 0)); +expectType(convert.xyz.hsl.raw(0, 0, 0)); +expectType(convert.xyz.hsv(0, 0, 0)); +expectType(convert.xyz.hsv.raw(0, 0, 0)); +expectType(convert.xyz.hwb(0, 0, 0)); +expectType(convert.xyz.hwb.raw(0, 0, 0)); +expectType(convert.xyz.cmyk(0, 0, 0)); +expectType(convert.xyz.cmyk.raw(0, 0, 0)); +expectType(convert.xyz.lch(0, 0, 0)); +expectType(convert.xyz.lch.raw(0, 0, 0)); +expectType(convert.xyz.hex(0, 0, 0)); +expectType(convert.xyz.hex.raw(0, 0, 0)); +expectType(convert.xyz.keyword(0, 0, 0)); +expectType(convert.xyz.keyword.raw(0, 0, 0)); +expectType(convert.xyz.ansi16(0, 0, 0)); +expectType(convert.xyz.ansi16.raw(0, 0, 0)); +expectType(convert.xyz.ansi256(0, 0, 0)); +expectType(convert.xyz.ansi256.raw(0, 0, 0)); +expectType(convert.xyz.hcg(0, 0, 0)); +expectType(convert.xyz.hcg.raw(0, 0, 0)); +expectType(convert.xyz.apple(0, 0, 0)); +expectType(convert.xyz.apple.raw(0, 0, 0)); +expectType(convert.xyz.gray(0, 0, 0)); +expectType(convert.xyz.gray.raw(0, 0, 0)); // LAB expectType(convert.lab.channels); @@ -76,11 +231,63 @@ expectType(convert.lab.xyz(0, 0, 0)); expectType(convert.lab.xyz.raw(0, 0, 0)); expectType(convert.lab.lch(0, 0, 0)); expectType(convert.lab.lch.raw(0, 0, 0)); +// - automatic conversions +expectType(convert.lab.rgb(0, 0, 0)); +expectType(convert.lab.rgb.raw(0, 0, 0)); +expectType(convert.lab.hsl(0, 0, 0)); +expectType(convert.lab.hsl.raw(0, 0, 0)); +expectType(convert.lab.hsv(0, 0, 0)); +expectType(convert.lab.hsv.raw(0, 0, 0)); +expectType(convert.lab.hwb(0, 0, 0)); +expectType(convert.lab.hwb.raw(0, 0, 0)); +expectType(convert.lab.cmyk(0, 0, 0)); +expectType(convert.lab.cmyk.raw(0, 0, 0)); +expectType(convert.lab.hex(0, 0, 0)); +expectType(convert.lab.hex.raw(0, 0, 0)); +expectType(convert.lab.keyword(0, 0, 0)); +expectType(convert.lab.keyword.raw(0, 0, 0)); +expectType(convert.lab.ansi16(0, 0, 0)); +expectType(convert.lab.ansi16.raw(0, 0, 0)); +expectType(convert.lab.ansi256(0, 0, 0)); +expectType(convert.lab.ansi256.raw(0, 0, 0)); +expectType(convert.lab.hcg(0, 0, 0)); +expectType(convert.lab.hcg.raw(0, 0, 0)); +expectType(convert.lab.apple(0, 0, 0)); +expectType(convert.lab.apple.raw(0, 0, 0)); +expectType(convert.lab.gray(0, 0, 0)); +expectType(convert.lab.gray.raw(0, 0, 0)); // LCH expectType(convert.lch.channels); expectType(convert.lch.lab(0, 0, 0)); expectType(convert.lch.lab.raw(0, 0, 0)); +// - automatic conversions +expectType(convert.lch.rgb(0, 0, 0)); +expectType(convert.lch.rgb.raw(0, 0, 0)); +expectType(convert.lch.hsl(0, 0, 0)); +expectType(convert.lch.hsl.raw(0, 0, 0)); +expectType(convert.lch.hsv(0, 0, 0)); +expectType(convert.lch.hsv.raw(0, 0, 0)); +expectType(convert.lch.hwb(0, 0, 0)); +expectType(convert.lch.hwb.raw(0, 0, 0)); +expectType(convert.lch.cmyk(0, 0, 0)); +expectType(convert.lch.cmyk.raw(0, 0, 0)); +expectType(convert.lch.xyz(0, 0, 0)); +expectType(convert.lch.xyz.raw(0, 0, 0)); +expectType(convert.lch.hex(0, 0, 0)); +expectType(convert.lch.hex.raw(0, 0, 0)); +expectType(convert.lch.keyword(0, 0, 0)); +expectType(convert.lch.keyword.raw(0, 0, 0)); +expectType(convert.lch.ansi16(0, 0, 0)); +expectType(convert.lch.ansi16.raw(0, 0, 0)); +expectType(convert.lch.ansi256(0, 0, 0)); +expectType(convert.lch.ansi256.raw(0, 0, 0)); +expectType(convert.lch.hcg(0, 0, 0)); +expectType(convert.lch.hcg.raw(0, 0, 0)); +expectType(convert.lch.apple(0, 0, 0)); +expectType(convert.lch.apple.raw(0, 0, 0)); +expectType(convert.lch.gray(0, 0, 0)); +expectType(convert.lch.gray.raw(0, 0, 0)); // HCG expectType(convert.hcg.channels); @@ -90,11 +297,61 @@ expectType(convert.hcg.hsv(0, 0, 0)); expectType(convert.hcg.hsv.raw(0, 0, 0)); expectType(convert.hcg.hwb(0, 0, 0)); expectType(convert.hcg.hwb.raw(0, 0, 0)); +// - automatic conversions +expectType(convert.hcg.hsl(0, 0, 0)); +expectType(convert.hcg.hsl.raw(0, 0, 0)); +expectType(convert.hcg.cmyk(0, 0, 0)); +expectType(convert.hcg.cmyk.raw(0, 0, 0)); +expectType(convert.hcg.xyz(0, 0, 0)); +expectType(convert.hcg.xyz.raw(0, 0, 0)); +expectType(convert.hcg.lab(0, 0, 0)); +expectType(convert.hcg.lab.raw(0, 0, 0)); +expectType(convert.hcg.lch(0, 0, 0)); +expectType(convert.hcg.lch.raw(0, 0, 0)); +expectType(convert.hcg.hex(0, 0, 0)); +expectType(convert.hcg.hex.raw(0, 0, 0)); +expectType(convert.hcg.keyword(0, 0, 0)); +expectType(convert.hcg.keyword.raw(0, 0, 0)); +expectType(convert.hcg.ansi16(0, 0, 0)); +expectType(convert.hcg.ansi16.raw(0, 0, 0)); +expectType(convert.hcg.ansi256(0, 0, 0)); +expectType(convert.hcg.ansi256.raw(0, 0, 0)); +expectType(convert.hcg.apple(0, 0, 0)); +expectType(convert.hcg.apple.raw(0, 0, 0)); +expectType(convert.hcg.gray(0, 0, 0)); +expectType(convert.hcg.gray.raw(0, 0, 0)); // Apple expectType(convert.apple.channels); expectType(convert.apple.rgb(0, 0, 0)); expectType(convert.apple.rgb.raw(0, 0, 0)); +// - automatic conversions +expectType(convert.apple.hsl(0, 0, 0)); +expectType(convert.apple.hsl.raw(0, 0, 0)); +expectType(convert.apple.hsv(0, 0, 0)); +expectType(convert.apple.hsv.raw(0, 0, 0)); +expectType(convert.apple.hwb(0, 0, 0)); +expectType(convert.apple.hwb.raw(0, 0, 0)); +expectType(convert.apple.cmyk(0, 0, 0)); +expectType(convert.apple.cmyk.raw(0, 0, 0)); +expectType(convert.apple.xyz(0, 0, 0)); +expectType(convert.apple.xyz.raw(0, 0, 0)); +expectType(convert.apple.lab(0, 0, 0)); +expectType(convert.apple.lab.raw(0, 0, 0)); +expectType(convert.apple.lch(0, 0, 0)); +expectType(convert.apple.lch.raw(0, 0, 0)); +expectType(convert.apple.hex(0, 0, 0)); +expectType(convert.apple.hex.raw(0, 0, 0)); +expectType(convert.apple.keyword(0, 0, 0)); +expectType(convert.apple.keyword.raw(0, 0, 0)); +expectType(convert.apple.ansi16(0, 0, 0)); +expectType(convert.apple.ansi16.raw(0, 0, 0)); +expectType(convert.apple.ansi256(0, 0, 0)); +expectType(convert.apple.ansi256.raw(0, 0, 0)); +expectType(convert.apple.hcg(0, 0, 0)); +expectType(convert.apple.hcg.raw(0, 0, 0)); +expectType(convert.apple.gray(0, 0, 0)); +expectType(convert.apple.gray.raw(0, 0, 0)); // Gray expectType(convert.gray.channels); @@ -112,3 +369,18 @@ expectType(convert.gray.lab(0)); expectType(convert.gray.lab.raw(0)); expectType(convert.gray.hex(0)); expectType(convert.gray.hex.raw(0)); +// - automatic conversions +expectType(convert.gray.xyz(0)); +expectType(convert.gray.xyz.raw(0)); +expectType(convert.gray.lch(0)); +expectType(convert.gray.lch.raw(0)); +expectType(convert.gray.keyword(0)); +expectType(convert.gray.keyword.raw(0)); +expectType(convert.gray.ansi16(0)); +expectType(convert.gray.ansi16.raw(0)); +expectType(convert.gray.ansi256(0)); +expectType(convert.gray.ansi256.raw(0)); +expectType(convert.gray.hcg(0)); +expectType(convert.gray.hcg.raw(0)); +expectType(convert.gray.apple(0)); +expectType(convert.gray.apple.raw(0));