UNPKG

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