This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 92
/
color.d.ts
123 lines (102 loc) · 3.7 KB
/
color.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
// This typescript file provides ambient types for color.js.
//
// Please consult that file for the implementation of the script.
declare module net.brehaut {
export interface Color {
// field accessors
getRed(): number;
setRed(newRed: number): Color;
getGreen(): number;
setGreen(newGreen: number): Color;
getBlue(): number;
setBlue(newBlue: number): Color;
getHue(): number;
setHue(newHue: number): Color;
getSaturation(): number;
setSaturation(newSaturation: number): Color;
getValue(): number;
setValue(newValue: number): Color;
getLightness(): number;
setLightness(newValue: number): Color;
getLuminance(): number;
getAlpha(): number;
setAlpha(newAlpha: number): Color;
// manipulation methods
shiftHue(degrees: number): Color;
darkenByAmount(amount: number): Color;
darkenByRatio(ratio: number): Color;
lightenByAmount(amount: number): Color;
lightenByRatio(amount: number): Color;
devalueByAmount(amount: number): Color;
devalueByRatio(ratio: number): Color;
valueByAmount(amount: number): Color;
valueByRatio(amount: number): Color;
desaturateByAmount(amount: number): Color;
desaturateByRatio(ratio: number): Color;
saturateByAmount(amount: number): Color;
saturateByRatio(ratio: number ): Color;
blend(color:Color, alpha:number): Color;
// generating lists of colors
schemeFromDegrees(listOfdegrees: number[]): Color[];
complementaryScheme(): Color[];
splitComplementaryScheme(): Color[];
splitComplementaryCWScheme(): Color[];
splitComplementaryCCWScheme(): Color[];
triadicScheme(): Color[];
clashScheme(): Color[];
tetradicScheme(): Color[];
fourToneCWScheme(): Color[];
fourToneCCWScheme(): Color[];
fiveToneAScheme(): Color[];
fiveToneBScheme(): Color[];
fiveToneCScheme(): Color[];
fiveToneDScheme(): Color[];
fiveToneEScheme(): Color[];
sixToneCWScheme(): Color[];
sixToneCCWScheme(): Color[];
neutralScheme(): Color[];
analogousScheme(): Color[];
// conversion and construction
toCSS(bytesPerChannel?: number): string;
toString(): string;
toHSV(): string;
toRGB(): string;
toHSL(): string;
}
// types used in construction of a Color
export interface RGBAValues {
red: number;
green: number;
blue: number;
alpha?: number;
}
export interface HSVAValue {
hue: number;
saturation: number;
value: number;
alpha?: number;
}
export interface HSLAValue {
hue: number;
saturation: number;
lightness: number;
alpha?: number;
}
export type ColorConstructorValue = string
| RGBAValues
| HSVAValue
| HSLAValue
| [number, number, number]
| [number, number, number, number];
// legacy names for constructor types. These are deprecated.
export type HSLValue = HSLAValue;
export type ValuesObject = RGBAValues
| HSVAValue
| HSLAValue
| {alpha?: number}; // the original interface.
// public constructor
function Color(): Color;
function Color(color: ColorConstructorValue): Color;
namespace Color{}
}
export = net.brehaut.Color;