diff --git a/types/src/color.d.ts b/types/src/color.d.ts index a37e5cdf2..94e2533b7 100644 --- a/types/src/color.d.ts +++ b/types/src/color.d.ts @@ -22,9 +22,10 @@ import { export type Coords = [number, number, number]; export interface ColorObject { - space: ColorSpace; + spaceId?: string | ColorSpace | undefined; + space?: string | ColorSpace | undefined; coords: Coords; - alpha?: number; + alpha?: number | undefined; } export interface ColorConstructor { @@ -80,7 +81,7 @@ declare namespace Color { declare class Color { constructor(color: ColorTypes); - constructor(space: string | ColorSpace, coords: Coords, alpha: number); + constructor(space: string | ColorSpace, coords: Coords, alpha?: number); // These signatures should always be the same as the constructor static get(color: ColorTypes): Color; diff --git a/types/test/color.ts b/types/test/color.ts index 870c1cc85..6e29ea03f 100644 --- a/types/test/color.ts +++ b/types/test/color.ts @@ -2,11 +2,10 @@ import Color from "colorjs.io/src/color"; // @ts-expect-error new Color(); -// @ts-expect-error -new Color("srgb", [1, 2, 3]); new Color("red"); new Color(new Color("red")); +new Color("srgb", [1, 2, 3]); new Color("srgb", [1, 2, 3], 1); const color = new Color("red");