-
-
Save bengry/caa2d602db5c011d12d4b54ad81f8b52 to your computer and use it in GitHub Desktop.
Partial types for https://www.npmjs.com/package/@texel/color (v1.1.4)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module '@texel/color' { | |
type Coords = [number, number, number]; | |
interface BaseColorSpace { | |
id: string; | |
base?: BaseColorSpace; | |
} | |
interface ColorSpace extends BaseColorSpace { | |
toBase?: (input: Coords, out?: Coords) => Coords; | |
fromBase?: (input: Coords, out?: Coords) => Coords; | |
} | |
type XYZColorMatrix = [ | |
[number, number, number], | |
[number, number, number], | |
[number, number, number], | |
]; | |
interface XYZColorSpace extends BaseColorSpace { | |
toXYZ_M: XYZColorMatrix; | |
fromXYZ_M: XYZColorMatrix; | |
toLMS_M: XYZColorMatrix; | |
fromLMS_M: XYZColorMatrix; | |
} | |
// srgb | |
declare const sRGB: ColorSpace; | |
export const sRGBLinear: XYZColorSpace; | |
// oklab | |
declare const OKLab: ColorSpace; | |
declare const OKLCH: ColorSpace; | |
declare const OKHSL: ColorSpace; | |
declare const OKHSV: ColorSpace; | |
function convert( | |
input: Coords, | |
fromSpace: ColorSpace, | |
toSpace: ColorSpace | |
): Coords; | |
function serialize( | |
coords: Coords, | |
inputSpace: ColorSpace, | |
outputSpace?: ColorSpace | |
): string; | |
function deserialize(colorString: string): ColorInfo; | |
interface ColorInfo { | |
id: ColorSpace['id']; | |
coords: Coords; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment