UNPKG

3.78 kBTypeScriptView Raw
1import * as definition from '.';
2export declare class Color implements definition.Color {
3 private _argb;
4 private _name;
5 constructor(color: number);
6 constructor(color: string);
7 constructor(a: number, r: number, g: number, b: number, type?: 'rbg' | 'hsl' | 'hsv');
8 get a(): number;
9 get r(): number;
10 get g(): number;
11 get b(): number;
12 get argb(): number;
13 get hex(): string;
14 get name(): string;
15 get ios(): UIColor;
16 get android(): number;
17 _argbFromString(hex: string): number;
18 equals(value: definition.Color): boolean;
19 static equals(value1: definition.Color, value2: definition.Color): boolean;
20 static isValid(value: any): boolean;
21 static fromHSL(a: any, h: any, s: any, l: any): Color;
22 static fromHSV(a: any, h: any, s: any, l: any): Color;
23 toString(): string;
24 static fromIosColor(value: UIColor): Color;
25 /**
26 * return true if brightness < 128
27 *
28 */
29 isDark(): boolean;
30 /**
31 * return true if brightness >= 128
32 *
33 */
34 isLight(): boolean;
35 /**
36 * return the [brightness](http://www.w3.org/TR/AERT#color-contrast)
37 *
38 */
39 getBrightness(): number;
40 /**
41 * return the [luminance](http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef)
42 *
43 */
44 getLuminance(): number;
45 /**
46 * Return this color (as a new Color instance) with the provided alpha
47 *
48 * @param alpha (between 0 and 255)
49 */
50 setAlpha(a: number): Color;
51 /**
52 * return the hsl representation of the color
53 *
54 */
55 toHsl(): {
56 a: number;
57 h: number;
58 s: number;
59 l: number;
60 };
61 /**
62 * return the [CSS hsv](https://www.w3schools.com/Css/css_colors_hsl.asp) representation of the color
63 *
64 */
65 toHslString(): string;
66 /**
67 * return the hsv representation of the color
68 *
69 */
70 toHsv(): {
71 a: number;
72 h: number;
73 s: number;
74 v: number;
75 };
76 /**
77 * return the [CSS hsv](https://www.w3schools.com/Css/css_colors_rgb.asp) representation of the color
78 *
79 */
80 toHsvString(): string;
81 /**
82 * return the [CSS rgb](https://www.w3schools.com/Css/css_colors_rgb.asp) representation of the color
83 *
84 */
85 toRgbString(): string;
86 /**
87 * Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling greyscale.
88 *
89 * @param amount (between 0 and 100)
90 */
91 desaturate(amount: number): Color;
92 /**
93 * Saturate the color a given amount, from 0 to 100.
94 *
95 * @param amount (between 0 and 100)
96 */
97 saturate(amount: number): Color;
98 /**
99 * Completely desaturates a color into greyscale. Same as calling desaturate(100).
100 *
101 */
102 greyscale(): Color;
103 /**
104 * Lighten the color a given amount, from 0 to 100. Providing 100 will always return white.
105 *
106 * @param amount (between 0 and 100)
107 */
108 lighten(amount: number): Color;
109 /**
110 * Brighten the color a given amount, from 0 to 100.
111 *
112 * @param amount (between 0 and 100)
113 */
114 brighten(amount: number): Color;
115 /**
116 * Darken the color a given amount, from 0 to 100. Providing 100 will always return black.
117 *
118 * @param amount (between 0 and 100)
119 */
120 darken(amount: number): Color;
121 /**
122 * Spin the hue a given amount, from -360 to 360. Calling with 0, 360, or -360 will do nothing (since it sets the hue back to what it was before).
123 *
124 * @param amount (between -360 and 360)
125 */
126 spin(amount: number): Color;
127 /**
128 * returns the color complement
129 *
130 */
131 complement(): Color;
132 static mix(color1: Color, color2: Color, amount?: number): Color;
133}
134
\No newline at end of file