1 | import {Value} from './index';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export class SassColor extends Value {
|
12 | |
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | constructor(options: {
|
19 | red: number;
|
20 | green: number;
|
21 | blue: number;
|
22 | alpha?: number;
|
23 | });
|
24 |
|
25 | /**
|
26 | * Creates an HSL color.
|
27 | *
|
28 | * @throws `Error` if `saturation` or `lightness` aren't between `0` and
|
29 | * `100`, or if `alpha` isn't between `0` and `1`.
|
30 | */
|
31 | constructor(options: {
|
32 | hue: number;
|
33 | saturation: number;
|
34 | lightness: number;
|
35 | alpha?: number;
|
36 | });
|
37 |
|
38 | /**
|
39 | * Creates an HWB color.
|
40 | *
|
41 | * @throws `Error` if `whiteness` or `blackness` aren't between `0` and `100`,
|
42 | * or if `alpha` isn't between `0` and `1`.
|
43 | */
|
44 | constructor(options: {
|
45 | hue: number;
|
46 | whiteness: number;
|
47 | blackness: number;
|
48 | alpha?: number;
|
49 | });
|
50 |
|
51 | /** This color's red channel, between `0` and `255`. */
|
52 | get red(): number;
|
53 |
|
54 | /** This color's green channel, between `0` and `255`. */
|
55 | get green(): number;
|
56 |
|
57 | /** This color's blue channel, between `0` and `255`. */
|
58 | get blue(): number;
|
59 |
|
60 | /** This color's hue, between `0` and `360`. */
|
61 | get hue(): number;
|
62 |
|
63 | /** This color's saturation, between `0` and `100`. */
|
64 | get saturation(): number;
|
65 |
|
66 | /** This color's lightness, between `0` and `100`. */
|
67 | get lightness(): number;
|
68 |
|
69 | /** This color's whiteness, between `0` and `100`. */
|
70 | get whiteness(): number;
|
71 |
|
72 | /** This color's blackness, between `0` and `100`. */
|
73 | get blackness(): number;
|
74 |
|
75 | /** This color's alpha channel, between `0` and `1`. */
|
76 | get alpha(): number;
|
77 |
|
78 | /**
|
79 | * Changes one or more of this color's RGB channels and returns the result.
|
80 | */
|
81 | change(options: {
|
82 | red?: number;
|
83 | green?: number;
|
84 | blue?: number;
|
85 | alpha?: number;
|
86 | }): SassColor;
|
87 |
|
88 | /**
|
89 | * Changes one or more of this color's HSL channels and returns the result.
|
90 | */
|
91 | change(options: {
|
92 | hue?: number;
|
93 | saturation?: number;
|
94 | lightness?: number;
|
95 | alpha?: number;
|
96 | }): SassColor;
|
97 |
|
98 | /**
|
99 | * Changes one or more of this color's HWB channels and returns the result.
|
100 | */
|
101 | change(options: {
|
102 | hue?: number;
|
103 | whiteness?: number;
|
104 | blackness?: number;
|
105 | alpha?: number;
|
106 | }): SassColor;
|
107 | }
|