1 | import { StringType } from './types';
|
2 | import { ColorProperty } from 'csstype';
|
3 | /**
|
4 | * Creates a color from a hex color code or named color.
|
5 | * e.g. color('red') or color('#FF0000') or color('#F00'))
|
6 | */
|
7 | export declare function color(value: ColorProperty): ColorHelper;
|
8 | /**
|
9 | * Creates a color from hue, saturation, and lightness. Alpha is automatically set to 100%
|
10 | * @param hue The hue of the color. This should be a number between 0-360.
|
11 | * @param saturation The saturation of the color. This should be a number between 0-1 or a percentage string between 0%-100%.
|
12 | * @param lightness The lightness of the color. This should be a number between 0-1 or a percentage string between 0%-100%.
|
13 | * @param alpha The alpha of the color. This should be a number between 0-1 or a percentage string between 0%-100%. If not specified, this defaults to 1.
|
14 | */
|
15 | export declare function hsl(hue: number, saturation: string | number, lightness: string | number, alpha?: string | number): ColorHelper;
|
16 | /**
|
17 | * Creates a color from hue, saturation, lightness, and alpha
|
18 | * @param hue The hue of the color. This should be a number between 0-360.
|
19 | * @param saturation The saturation of the color. This should be a number between 0-1 or a percentage string between 0%-100%.
|
20 | * @param lightness The lightness of the color. This should be a number between 0-1 or a percentage string between 0%-100%.
|
21 | * @param alpha The alpha of the color. This should be a number between 0-1 or a percentage string between 0%-100%.
|
22 | */
|
23 | export declare function hsla(hue: number, saturation: string | number, lightness: string | number, alpha: string | number): ColorHelper;
|
24 | /**
|
25 | * Creates a color form the red, blue, and green color space. Alpha is automatically set to 100%
|
26 | * @param red The red channel of the color. This should be a number between 0-255.
|
27 | * @param blue The blue channel of the color. This should be a number between 0-255.
|
28 | * @param green The green channel of the color. This should be a number between 0-255.
|
29 | * @param alpha The alpha of the color. This should be a number between 0-1 or a percentage string between 0%-100%. If not specified, this defaults to 1.
|
30 | */
|
31 | export declare function rgb(red: number, blue: number, green: number, alpha?: string | number): ColorHelper;
|
32 | /**
|
33 | * Creates a color form the red, blue, green, and alpha in the color space
|
34 | * @param red The red channel of the color. This should be a number between 0-255.
|
35 | * @param blue The blue channel of the color. This should be a number between 0-255.
|
36 | * @param green The green channel of the color. This should be a number between 0-255.
|
37 | * @param alpha The alpha of the color. This should be a number between 0-1 or a percentage string between 0%-100%.
|
38 | */
|
39 | export declare function rgba(red: number, blue: number, green: number, alpha: string | number): ColorHelper;
|
40 | /**
|
41 | * A CSS Color. Includes utilities for converting between color types
|
42 | */
|
43 | export declare class ColorHelper implements StringType<ColorProperty> {
|
44 | /**
|
45 | * Format of the color
|
46 | * @private
|
47 | */
|
48 | private f;
|
49 | /**
|
50 | * True if the color should output opacity in the formatted result
|
51 | * @private
|
52 | */
|
53 | private o;
|
54 | /**
|
55 | * Channel 0
|
56 | * @private
|
57 | */
|
58 | private r;
|
59 | /**
|
60 | * Channel 1
|
61 | * @private
|
62 | */
|
63 | private g;
|
64 | /**
|
65 | * Channel 2
|
66 | * @private
|
67 | */
|
68 | private b;
|
69 | /**
|
70 | * Channel Alpha
|
71 | * @private
|
72 | */
|
73 | private a;
|
74 | constructor(format: 'rgb' | 'hsl', r: number, g: number, b: number, a: number, hasAlpha: boolean);
|
75 | /**
|
76 | * Converts the stored color into string form (which is used by Free Style)
|
77 | */
|
78 | toString(): ColorProperty;
|
79 | /**
|
80 | * Converts to hex rgb(255, 255, 255) to #FFFFFF
|
81 | */
|
82 | toHexString(): string;
|
83 | /**
|
84 | * Converts to the Hue, Saturation, Lightness color space
|
85 | */
|
86 | toHSL(): ColorHelper;
|
87 | /**
|
88 | * Converts to the Hue, Saturation, Lightness color space and adds an alpha channel
|
89 | */
|
90 | toHSLA(): ColorHelper;
|
91 | /**
|
92 | * Converts to the Red, Green, Blue color space
|
93 | */
|
94 | toRGB(): ColorHelper;
|
95 | /**
|
96 | * Converts to the Red, Green, Blue color space and adds an alpha channel
|
97 | */
|
98 | toRGBA(): ColorHelper;
|
99 | red(): number;
|
100 | green(): number;
|
101 | blue(): number;
|
102 | hue(): number;
|
103 | saturation(): number;
|
104 | lightness(): number;
|
105 | alpha(): number;
|
106 | opacity(): number;
|
107 | invert(): ColorHelper;
|
108 | lighten(percent: string | number, relative?: boolean): ColorHelper;
|
109 | darken(percent: string | number, relative?: boolean): ColorHelper;
|
110 | saturate(percent: string | number, relative?: boolean): ColorHelper;
|
111 | desaturate(percent: string | number, relative?: boolean): ColorHelper;
|
112 | grayscale(): ColorHelper;
|
113 | fade(percent: string | number): ColorHelper;
|
114 | fadeOut(percent: string | number, relative?: boolean): ColorHelper;
|
115 | fadeIn(percent: string | number, relative?: boolean): ColorHelper;
|
116 | mix(mixin: string | ColorHelper, weight?: number): ColorHelper;
|
117 | tint(weight: number): ColorHelper;
|
118 | shade(weight: number): ColorHelper;
|
119 | spin(degrees: number): ColorHelper;
|
120 | }
|