-
Notifications
You must be signed in to change notification settings - Fork 270
/
Copy pathindex.d.ts
135 lines (130 loc) · 4.65 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import type convert from 'color-convert';
export type ColorLike = ColorInstance | string | ArrayLike<number> | number | Record<string, any>;
export type ColorJson = {model: string; color: number[]; valpha: number};
export type ColorObject = {alpha?: number | undefined} & Record<string, number>;
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export interface ColorInstance {
toString(): string;
// eslint-disable-next-line @typescript-eslint/naming-convention
toJSON(): ColorJson;
string(places?: number): string;
percentString(places?: number): string;
array(): number[];
object(): ColorObject;
unitArray(): number[];
unitObject(): {r: number; g: number; b: number; alpha?: number | undefined};
round(places?: number): ColorInstance;
alpha(): number;
alpha(value: number): ColorInstance;
red(): number;
red(value: number): ColorInstance;
green(): number;
green(value: number): ColorInstance;
blue(): number;
blue(value: number): ColorInstance;
hue(): number;
hue(value: number): ColorInstance;
saturationl(): number;
saturationl(value: number): ColorInstance;
lightness(): number;
lightness(value: number): ColorInstance;
saturationv(): number;
saturationv(value: number): ColorInstance;
value(): number;
value(value: number): ColorInstance;
chroma(): number;
chroma(value: number): ColorInstance;
gray(): number;
gray(value: number): ColorInstance;
white(): number;
white(value: number): ColorInstance;
wblack(): number;
wblack(value: number): ColorInstance;
cyan(): number;
cyan(value: number): ColorInstance;
magenta(): number;
magenta(value: number): ColorInstance;
yellow(): number;
yellow(value: number): ColorInstance;
black(): number;
black(value: number): ColorInstance;
x(): number;
x(value: number): ColorInstance;
y(): number;
y(value: number): ColorInstance;
z(): number;
z(value: number): ColorInstance;
l(): number;
l(value: number): ColorInstance;
a(): number;
a(value: number): ColorInstance;
b(): number;
b(value: number): ColorInstance;
keyword(): string;
keyword<V extends string>(value: V): ColorInstance;
hex(): string;
hex<V extends string>(value: V): ColorInstance;
hexa(): string;
hexa<V extends string>(value: V): ColorInstance;
rgbNumber(): number;
luminosity(): number;
contrast(color2: ColorInstance): number;
level(color2: ColorInstance): 'AAA' | 'AA' | '';
isDark(): boolean;
isLight(): boolean;
negate(): ColorInstance;
lighten(ratio: number): ColorInstance;
darken(ratio: number): ColorInstance;
saturate(ratio: number): ColorInstance;
desaturate(ratio: number): ColorInstance;
whiten(ratio: number): ColorInstance;
blacken(ratio: number): ColorInstance;
grayscale(): ColorInstance;
fade(ratio: number): ColorInstance;
opaquer(ratio: number): ColorInstance;
rotate(degrees: number): ColorInstance;
mix(mixinColor: ColorInstance, weight?: number): ColorInstance;
rgb(...arguments_: number[]): ColorInstance;
hsl(...arguments_: number[]): ColorInstance;
hsv(...arguments_: number[]): ColorInstance;
hwb(...arguments_: number[]): ColorInstance;
cmyk(...arguments_: number[]): ColorInstance;
xyz(...arguments_: number[]): ColorInstance;
lab(...arguments_: number[]): ColorInstance;
lch(...arguments_: number[]): ColorInstance;
ansi16(...arguments_: number[]): ColorInstance;
ansi256(...arguments_: number[]): ColorInstance;
hcg(...arguments_: number[]): ColorInstance;
apple(...arguments_: number[]): ColorInstance;
}
export type ColorConstructor = {
(object?: ColorLike, model?: keyof (typeof convert)): ColorInstance;
new(object?: ColorLike, model?: keyof (typeof convert)): ColorInstance;
rgb(...value: number[]): ColorInstance;
rgb(color: ColorLike): ColorInstance;
hsl(...value: number[]): ColorInstance;
hsl(color: ColorLike): ColorInstance;
hsv(...value: number[]): ColorInstance;
hsv(color: ColorLike): ColorInstance;
hwb(...value: number[]): ColorInstance;
hwb(color: ColorLike): ColorInstance;
cmyk(...value: number[]): ColorInstance;
cmyk(color: ColorLike): ColorInstance;
xyz(...value: number[]): ColorInstance;
xyz(color: ColorLike): ColorInstance;
lab(...value: number[]): ColorInstance;
lab(color: ColorLike): ColorInstance;
lch(...value: number[]): ColorInstance;
lch(color: ColorLike): ColorInstance;
ansi16(...value: number[]): ColorInstance;
ansi16(color: ColorLike): ColorInstance;
ansi256(...value: number[]): ColorInstance;
ansi256(color: ColorLike): ColorInstance;
hcg(...value: number[]): ColorInstance;
hcg(color: ColorLike): ColorInstance;
apple(...value: number[]): ColorInstance;
apple(color: ColorLike): ColorInstance;
};
// eslint-disable-next-line @typescript-eslint/naming-convention
declare const Color: ColorConstructor;
export default Color;