UNPKG

1.12 kBTypeScriptView Raw
1// Type definitions for color-string 1.5
2// Project: https://github.com/qix-/color-string#readme
3// Definitions by: BendingBender <https://github.com/BendingBender>
4// Dan Marshall <https://github.com/danmarshall>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6
7export type Color = [number, number, number, number];
8
9export interface ColorDescriptor {
10 model: 'rgb' | 'hsl' | 'hwb';
11 value: Color;
12}
13
14export function get(colorString: string): ColorDescriptor | null;
15
16export namespace get {
17 function hsl(colorString: string): Color | null;
18 function hwb(colorString: string): Color | null;
19 function rgb(colorString: string): Color | null;
20}
21
22export namespace to {
23 function hex(...args: Array<number | number[]>): string;
24 function rgb(...args: Array<number | number[]>): string;
25 namespace rgb {
26 function percent(...args: Array<number | number[]>): string;
27 }
28 function keyword(...args: Array<number | number[]>): string;
29 function hsl(...args: Array<number | number[]>): string;
30 function hwb(...args: Array<number | number[]>): string;
31}