diff --git a/packages/color/src/hcya.ts b/packages/color/src/hcya.ts index e97c7513a7..9da4c2a95e 100644 --- a/packages/color/src/hcya.ts +++ b/packages/color/src/hcya.ts @@ -3,10 +3,10 @@ import { Color, ColorMode } from "./api"; import { AColor } from "./internal/acolor"; import { ensureArgs } from "./internal/ensure-args"; -export function hcya(col: Color): HCYA; +export function hcya(col: Color, offset?: number, stride?: number): HCYA; export function hcya(h?: number, c?: number, y?: number, a?: number): HCYA; export function hcya(...args: any[]) { - return new HCYA(ensureArgs(args)); + return new HCYA(...ensureArgs(args)); } export class HCYA extends AColor implements IVector { diff --git a/packages/color/src/hsia.ts b/packages/color/src/hsia.ts index f6e38eb240..800122e537 100644 --- a/packages/color/src/hsia.ts +++ b/packages/color/src/hsia.ts @@ -3,10 +3,10 @@ import { Color, ColorMode } from "./api"; import { AColor } from "./internal/acolor"; import { ensureArgs } from "./internal/ensure-args"; -export function hsia(col: Color): HSIA; +export function hsia(col: Color, offset?: number, stride?: number): HSIA; export function hsia(h?: number, s?: number, i?: number, a?: number): HSIA; export function hsia(...args: any[]) { - return new HSIA(ensureArgs(args)); + return new HSIA(...ensureArgs(args)); } export class HSIA extends AColor implements IVector { diff --git a/packages/color/src/hsla.ts b/packages/color/src/hsla.ts index 04a9b0cbb5..c8c5b7b4f8 100644 --- a/packages/color/src/hsla.ts +++ b/packages/color/src/hsla.ts @@ -3,10 +3,10 @@ import { Color, ColorMode } from "./api"; import { AColor } from "./internal/acolor"; import { ensureArgs } from "./internal/ensure-args"; -export function hsla(col: Color): HSLA; +export function hsla(col: Color, offset?: number, stride?: number): HSLA; export function hsla(h?: number, s?: number, l?: number, a?: number): HSLA; export function hsla(...args: any[]) { - return new HSLA(ensureArgs(args)); + return new HSLA(...ensureArgs(args)); } export class HSLA extends AColor implements IVector { diff --git a/packages/color/src/hsva.ts b/packages/color/src/hsva.ts index 764a897c44..c12f2839f9 100644 --- a/packages/color/src/hsva.ts +++ b/packages/color/src/hsva.ts @@ -3,10 +3,10 @@ import { Color, ColorMode } from "./api"; import { AColor } from "./internal/acolor"; import { ensureArgs } from "./internal/ensure-args"; -export function hsva(col: Color): HSVA; +export function hsva(col: Color, offset?: number, stride?: number): HSVA; export function hsva(h?: number, s?: number, v?: number, a?: number): HSVA; export function hsva(...args: any[]) { - return new HSVA(ensureArgs(args)); + return new HSVA(...ensureArgs(args)); } export class HSVA extends AColor implements IVector { diff --git a/packages/color/src/internal/ensure-args.ts b/packages/color/src/internal/ensure-args.ts index 1cf0422c32..c9af4ba94e 100644 --- a/packages/color/src/internal/ensure-args.ts +++ b/packages/color/src/internal/ensure-args.ts @@ -2,14 +2,14 @@ export const ensureArgs = (args: any[]) => { if (typeof args[0] === "number") { switch (args.length) { case 1: - return args.push(0, 0, 1), args; + return args.push(0, 0, 1), [args]; case 2: - return args.push(0, 1), args; + return args.push(0, 1), [args]; case 3: - return args.push(1), args; + return args.push(1), [args]; default: - return args; + return [args]; } } - return args[0]; + return args; }; diff --git a/packages/color/src/rgba.ts b/packages/color/src/rgba.ts index a5e1c60be2..204beafb69 100644 --- a/packages/color/src/rgba.ts +++ b/packages/color/src/rgba.ts @@ -3,10 +3,10 @@ import { Color, ColorMode } from "./api"; import { AColor } from "./internal/acolor"; import { ensureArgs } from "./internal/ensure-args"; -export function rgba(col: Color): RGBA; +export function rgba(col: Color, offset?: number, stride?: number): RGBA; export function rgba(r?: number, g?: number, b?: number, a?: number): RGBA; export function rgba(...args: any[]) { - return new RGBA(ensureArgs(args)); + return new RGBA(...ensureArgs(args)); } export class RGBA extends AColor implements IVector { diff --git a/packages/color/src/xyza.ts b/packages/color/src/xyza.ts index 209531726c..58796af3e4 100644 --- a/packages/color/src/xyza.ts +++ b/packages/color/src/xyza.ts @@ -3,10 +3,10 @@ import { Color, ColorMode } from "./api"; import { AColor } from "./internal/acolor"; import { ensureArgs } from "./internal/ensure-args"; -export function xyza(col: Color): XYZA; +export function xyza(col: Color, offset?: number, stride?: number): XYZA; export function xyza(x?: number, y?: number, z?: number, a?: number): XYZA; export function xyza(...args: any[]) { - return new XYZA(ensureArgs(args)); + return new XYZA(...ensureArgs(args)); } export class XYZA extends AColor implements IVector { diff --git a/packages/color/src/ycbcr.ts b/packages/color/src/ycbcr.ts index 270fb904f7..01e57fcbf1 100644 --- a/packages/color/src/ycbcr.ts +++ b/packages/color/src/ycbcr.ts @@ -3,10 +3,10 @@ import { Color, ColorMode } from "./api"; import { AColor } from "./internal/acolor"; import { ensureArgs } from "./internal/ensure-args"; -export function ycbcra(col: Color): YCbCrA; +export function ycbcra(col: Color, offset?: number, stride?: number): YCbCrA; export function ycbcra(y: number, b: number, r: number, a?: number): YCbCrA; export function ycbcra(...args: any[]) { - return new YCbCrA(ensureArgs(args)); + return new YCbCrA(...ensureArgs(args)); } export class YCbCrA extends AColor implements IVector {