sass 1.78.0 → 1.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/sass.dart.js +11402 -3995
- package/types/deprecations.d.ts +29 -1
- package/types/index.d.ts +18 -0
- package/types/value/color.d.ts +505 -67
- package/types/value/index.d.ts +21 -1
package/types/value/color.d.ts
CHANGED
|
@@ -1,5 +1,103 @@
|
|
|
1
|
+
import {List} from 'immutable';
|
|
2
|
+
|
|
1
3
|
import {Value} from './index';
|
|
2
4
|
|
|
5
|
+
/** The HSL color space name. */
|
|
6
|
+
export type ColorSpaceHsl = 'hsl';
|
|
7
|
+
|
|
8
|
+
/** The HSL color space channel names. */
|
|
9
|
+
export type ChannelNameHsl = 'hue' | 'saturation' | 'lightness' | 'alpha';
|
|
10
|
+
|
|
11
|
+
/** The HWB color space name. */
|
|
12
|
+
export type ColorSpaceHwb = 'hwb';
|
|
13
|
+
|
|
14
|
+
/** The HWB color space channel names. */
|
|
15
|
+
export type ChannelNameHwb = 'hue' | 'whiteness' | 'blackness' | 'alpha';
|
|
16
|
+
|
|
17
|
+
/** The Lab / Oklab color space names. */
|
|
18
|
+
export type ColorSpaceLab = 'lab' | 'oklab';
|
|
19
|
+
|
|
20
|
+
/** The Lab / Oklab color space channel names. */
|
|
21
|
+
export type ChannelNameLab = 'lightness' | 'a' | 'b' | 'alpha';
|
|
22
|
+
|
|
23
|
+
/** The LCH / Oklch color space names. */
|
|
24
|
+
export type ColorSpaceLch = 'lch' | 'oklch';
|
|
25
|
+
|
|
26
|
+
/** The LCH / Oklch color space channel names. */
|
|
27
|
+
export type ChannelNameLch = 'lightness' | 'chroma' | 'hue' | 'alpha';
|
|
28
|
+
|
|
29
|
+
/** Names of color spaces with RGB channels. */
|
|
30
|
+
export type ColorSpaceRgb =
|
|
31
|
+
| 'a98-rgb'
|
|
32
|
+
| 'display-p3'
|
|
33
|
+
| 'prophoto-rgb'
|
|
34
|
+
| 'rec2020'
|
|
35
|
+
| 'rgb'
|
|
36
|
+
| 'srgb'
|
|
37
|
+
| 'srgb-linear';
|
|
38
|
+
|
|
39
|
+
/** RGB channel names. */
|
|
40
|
+
export type ChannelNameRgb = 'red' | 'green' | 'blue' | 'alpha';
|
|
41
|
+
|
|
42
|
+
/** Names of color spaces with XYZ channels. */
|
|
43
|
+
export type ColorSpaceXyz = 'xyz' | 'xyz-d50' | 'xyz-d65';
|
|
44
|
+
|
|
45
|
+
/** XYZ channel names. */
|
|
46
|
+
export type ChannelNameXyz = 'x' | 'y' | 'z' | 'alpha';
|
|
47
|
+
|
|
48
|
+
/** All supported color space channel names. */
|
|
49
|
+
export type ChannelName =
|
|
50
|
+
| ChannelNameHsl
|
|
51
|
+
| ChannelNameHwb
|
|
52
|
+
| ChannelNameLab
|
|
53
|
+
| ChannelNameLch
|
|
54
|
+
| ChannelNameRgb
|
|
55
|
+
| ChannelNameXyz;
|
|
56
|
+
|
|
57
|
+
/** All supported color space names. */
|
|
58
|
+
export type KnownColorSpace =
|
|
59
|
+
| ColorSpaceHsl
|
|
60
|
+
| ColorSpaceHwb
|
|
61
|
+
| ColorSpaceLab
|
|
62
|
+
| ColorSpaceLch
|
|
63
|
+
| ColorSpaceRgb
|
|
64
|
+
| ColorSpaceXyz;
|
|
65
|
+
|
|
66
|
+
/** Polar color space names (HSL, HWB, LCH, and Oklch spaces). */
|
|
67
|
+
export type PolarColorSpace = ColorSpaceHsl | ColorSpaceHwb | ColorSpaceLch;
|
|
68
|
+
|
|
69
|
+
/** Rectangular color space names (Lab, Oklab, RGB, and XYZ spaces). */
|
|
70
|
+
export type RectangularColorSpace = Exclude<KnownColorSpace, PolarColorSpace>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Methods by which two hues are adjusted when interpolating between polar
|
|
74
|
+
* colors.
|
|
75
|
+
*/
|
|
76
|
+
export type HueInterpolationMethod =
|
|
77
|
+
| 'decreasing'
|
|
78
|
+
| 'increasing'
|
|
79
|
+
| 'longer'
|
|
80
|
+
| 'shorter';
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Methods by which colors in bounded spaces can be mapped to within their
|
|
84
|
+
* gamut.
|
|
85
|
+
*
|
|
86
|
+
* * `local-minde`: The algorithm specified in [the original Color Level 4
|
|
87
|
+
* candidate recommendation]. This maps in the Oklch color space, using the
|
|
88
|
+
* [deltaEOK] color difference formula and the [local-MINDE] improvement.
|
|
89
|
+
*
|
|
90
|
+
* * `clip`: Clamp each color channel that's outside the gamut to the minimum or
|
|
91
|
+
* maximum value for that channel. This algorithm will produce poor visual
|
|
92
|
+
* results, but it may be useful to match the behavior of other situations in
|
|
93
|
+
* which a color can be clipped.
|
|
94
|
+
*
|
|
95
|
+
* [the original Color Level 4 candidate recommendation]: https://www.w3.org/TR/2024/CRD-css-color-4-20240213/#css-gamut-mapping
|
|
96
|
+
* [deltaEOK]: https://www.w3.org/TR/2024/CRD-css-color-4-20240213/#color-difference-OK
|
|
97
|
+
* [local-MINDE]: https://www.w3.org/TR/2024/CRD-css-color-4-20240213/#GM-chroma-local-MINDE
|
|
98
|
+
*/
|
|
99
|
+
export type GamutMapMethod = 'clip' | 'local-minde';
|
|
100
|
+
|
|
3
101
|
/**
|
|
4
102
|
* Sass's [color type](https://sass-lang.com/documentation/values/colors).
|
|
5
103
|
*
|
|
@@ -10,119 +108,459 @@ import {Value} from './index';
|
|
|
10
108
|
*/
|
|
11
109
|
export class SassColor extends Value {
|
|
12
110
|
/**
|
|
13
|
-
* Creates an RGB color.
|
|
111
|
+
* Creates an [RGB color].
|
|
112
|
+
*
|
|
113
|
+
* If `space` is missing, **only** `undefined` should be used to indicate that
|
|
114
|
+
* `alpha` isn't passed. If `null` is used instead, it will be treated as a
|
|
115
|
+
* [missing component]. See [breaking changes] for details.
|
|
14
116
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* future versions of Dart Sass. See [breaking changes] for details.
|
|
117
|
+
* If `space` is defined and `null` is passed for any component, it will be
|
|
118
|
+
* treated as a [missing component].
|
|
18
119
|
*
|
|
120
|
+
* [RGB color]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb
|
|
19
121
|
* [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
20
122
|
* [breaking changes]: /documentation/breaking-changes/null-alpha
|
|
21
123
|
*
|
|
22
|
-
* @throws `Error` if `
|
|
23
|
-
*
|
|
124
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
125
|
+
* and `1`.
|
|
24
126
|
*/
|
|
25
127
|
constructor(options: {
|
|
26
|
-
red: number;
|
|
27
|
-
green: number;
|
|
28
|
-
blue: number;
|
|
29
|
-
alpha?: number;
|
|
128
|
+
red: number | null;
|
|
129
|
+
green: number | null;
|
|
130
|
+
blue: number | null;
|
|
131
|
+
alpha?: number | null;
|
|
132
|
+
space?: 'rgb';
|
|
30
133
|
});
|
|
31
134
|
|
|
32
135
|
/**
|
|
33
|
-
* Creates an HSL color.
|
|
136
|
+
* Creates an [HSL color].
|
|
137
|
+
*
|
|
138
|
+
* If `space` is missing, **only** `undefined` should be used to indicate that
|
|
139
|
+
* `alpha` isn't passed. If `null` is used instead, it will be treated as a
|
|
140
|
+
* [missing component]. See [breaking changes] for details.
|
|
34
141
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* future versions of Dart Sass. See [breaking changes] for details.
|
|
142
|
+
* If `space` is defined and `null` is passed for any component, it will be
|
|
143
|
+
* treated as a [missing component].
|
|
38
144
|
*
|
|
145
|
+
* [HSL color]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hsl
|
|
39
146
|
* [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
40
147
|
* [breaking changes]: /documentation/breaking-changes/null-alpha
|
|
41
148
|
*
|
|
42
|
-
* @throws `Error` if `
|
|
43
|
-
*
|
|
149
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
150
|
+
* and `1`.
|
|
44
151
|
*/
|
|
45
152
|
constructor(options: {
|
|
46
|
-
hue: number;
|
|
47
|
-
saturation: number;
|
|
48
|
-
lightness: number;
|
|
49
|
-
alpha?: number;
|
|
153
|
+
hue: number | null;
|
|
154
|
+
saturation: number | null;
|
|
155
|
+
lightness: number | null;
|
|
156
|
+
alpha?: number | null;
|
|
157
|
+
space?: ColorSpaceHsl;
|
|
50
158
|
});
|
|
51
159
|
|
|
52
160
|
/**
|
|
53
|
-
* Creates an HWB color.
|
|
161
|
+
* Creates an [HWB color].
|
|
54
162
|
*
|
|
55
|
-
* **
|
|
56
|
-
* `null` is
|
|
57
|
-
*
|
|
163
|
+
* If `space` is missing, **only** `undefined` should be used to indicate that
|
|
164
|
+
* `alpha` isn't passed. If `null` is used instead, it will be treated as a
|
|
165
|
+
* [missing component]. See [breaking changes] for details.
|
|
58
166
|
*
|
|
167
|
+
* If `space` is defined and `null` is passed for any component, it will be
|
|
168
|
+
* treated as a [missing component].
|
|
169
|
+
*
|
|
170
|
+
* [HWB color]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb
|
|
59
171
|
* [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
60
172
|
* [breaking changes]: /documentation/breaking-changes/null-alpha
|
|
61
173
|
*
|
|
62
|
-
* @throws `Error` if `
|
|
63
|
-
*
|
|
174
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
175
|
+
* and `1`.
|
|
64
176
|
*/
|
|
65
177
|
constructor(options: {
|
|
66
|
-
hue: number;
|
|
67
|
-
whiteness: number;
|
|
68
|
-
blackness: number;
|
|
69
|
-
alpha?: number;
|
|
178
|
+
hue: number | null;
|
|
179
|
+
whiteness: number | null;
|
|
180
|
+
blackness: number | null;
|
|
181
|
+
alpha?: number | null;
|
|
182
|
+
space?: ColorSpaceHwb;
|
|
70
183
|
});
|
|
71
184
|
|
|
72
|
-
/**
|
|
73
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Creates a [Lab] or [Oklab] color.
|
|
187
|
+
*
|
|
188
|
+
* If `null` is passed for any component, it will be treated as a [missing
|
|
189
|
+
* component].
|
|
190
|
+
*
|
|
191
|
+
* [Lab]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lab
|
|
192
|
+
* [Oklab]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklab
|
|
193
|
+
* [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
194
|
+
*
|
|
195
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
196
|
+
* and `1`.
|
|
197
|
+
*/
|
|
198
|
+
constructor(options: {
|
|
199
|
+
lightness: number | null;
|
|
200
|
+
a: number | null;
|
|
201
|
+
b: number | null;
|
|
202
|
+
alpha?: number | null;
|
|
203
|
+
space: ColorSpaceLab;
|
|
204
|
+
});
|
|
74
205
|
|
|
75
|
-
/**
|
|
76
|
-
|
|
206
|
+
/**
|
|
207
|
+
* Creates an [LCH] or [Oklch] color.
|
|
208
|
+
*
|
|
209
|
+
* If `null` is passed for any component, it will be treated as a [missing
|
|
210
|
+
* component].
|
|
211
|
+
*
|
|
212
|
+
* [LCH]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch
|
|
213
|
+
* [Oklch]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch
|
|
214
|
+
* [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
215
|
+
*
|
|
216
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
217
|
+
* and `1`.
|
|
218
|
+
*/
|
|
219
|
+
constructor(options: {
|
|
220
|
+
lightness: number | null;
|
|
221
|
+
chroma: number | null;
|
|
222
|
+
hue: number | null;
|
|
223
|
+
alpha?: number | null;
|
|
224
|
+
space: ColorSpaceLch;
|
|
225
|
+
});
|
|
77
226
|
|
|
78
|
-
/**
|
|
79
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Creates a color in a predefined [RGB color space].
|
|
229
|
+
*
|
|
230
|
+
* If `null` is passed for any component, it will be treated as a [missing
|
|
231
|
+
* component].
|
|
232
|
+
*
|
|
233
|
+
* [RGB color space]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color#using_predefined_colorspaces_with_color
|
|
234
|
+
* [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
235
|
+
*
|
|
236
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
237
|
+
* and `1`.
|
|
238
|
+
*/
|
|
239
|
+
constructor(options: {
|
|
240
|
+
red: number | null;
|
|
241
|
+
green: number | null;
|
|
242
|
+
blue: number | null;
|
|
243
|
+
alpha?: number | null;
|
|
244
|
+
space: Exclude<ColorSpaceRgb, 'rgb'>;
|
|
245
|
+
});
|
|
80
246
|
|
|
81
|
-
/**
|
|
82
|
-
|
|
247
|
+
/**
|
|
248
|
+
* Creates a color in a predefined [XYZ color space].
|
|
249
|
+
*
|
|
250
|
+
* If `null` is passed for any component, it will be treated as a [missing
|
|
251
|
+
* component].
|
|
252
|
+
*
|
|
253
|
+
* [XYZ color space]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color#using_the_xyz_colorspace_with_color
|
|
254
|
+
* [missing component]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
255
|
+
*
|
|
256
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
257
|
+
* and `1`.
|
|
258
|
+
*/
|
|
259
|
+
constructor(options: {
|
|
260
|
+
x: number | null;
|
|
261
|
+
y: number | null;
|
|
262
|
+
z: number | null;
|
|
263
|
+
alpha?: number | null;
|
|
264
|
+
space: ColorSpaceXyz;
|
|
265
|
+
});
|
|
83
266
|
|
|
84
|
-
/**
|
|
85
|
-
get
|
|
267
|
+
/** The name of this color's space. */
|
|
268
|
+
get space(): KnownColorSpace;
|
|
86
269
|
|
|
87
|
-
/**
|
|
88
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Returns a new color that's the result of converting this color to the
|
|
272
|
+
* specified `space`.
|
|
273
|
+
*/
|
|
274
|
+
toSpace(space: KnownColorSpace): SassColor;
|
|
89
275
|
|
|
90
|
-
/**
|
|
91
|
-
|
|
276
|
+
/**
|
|
277
|
+
* A boolean indicating whether this color is in a legacy color space (`rgb`,
|
|
278
|
+
* `hsl`, or `hwb`).
|
|
279
|
+
*/
|
|
280
|
+
get isLegacy(): boolean;
|
|
92
281
|
|
|
93
|
-
/**
|
|
94
|
-
|
|
282
|
+
/**
|
|
283
|
+
* Returns a boolean indicating whether this color is in-gamut (as opposed to
|
|
284
|
+
* having one or more of its channels out of bounds) for the specified
|
|
285
|
+
* `space`, or its current color space if `space` is not specified.
|
|
286
|
+
*/
|
|
287
|
+
isInGamut(space?: KnownColorSpace): boolean;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Returns a copy of this color, modified so it is in-gamut for the specified
|
|
291
|
+
* `space`—or the current color space if `space` is not specified—using
|
|
292
|
+
* `method` to map out-of-gamut colors into the desired gamut.
|
|
293
|
+
*/
|
|
294
|
+
toGamut(options: {
|
|
295
|
+
space?: KnownColorSpace;
|
|
296
|
+
method: GamutMapMethod;
|
|
297
|
+
}): SassColor;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* A list of this color's channel values (excluding alpha), with [missing
|
|
301
|
+
* channels] converted to `null`.
|
|
302
|
+
*
|
|
303
|
+
* [missing channels]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
304
|
+
*/
|
|
305
|
+
get channelsOrNull(): List<number | null>;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* A list of this color's channel values (excluding alpha), with [missing
|
|
309
|
+
* channels] converted to `0`.
|
|
310
|
+
*
|
|
311
|
+
* [missing channels]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
312
|
+
*/
|
|
313
|
+
get channels(): List<number>;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Returns the value of a single specified `channel` of this color, with
|
|
317
|
+
* [missing channels] converted to `0`.
|
|
318
|
+
*
|
|
319
|
+
* [missing channels]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
320
|
+
*
|
|
321
|
+
* @throws `Error` if `channel` is not `alpha` or a channel in this color's
|
|
322
|
+
* space.
|
|
323
|
+
*/
|
|
324
|
+
channel(channel: ChannelName): number;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Returns the value of a single specified `channel` of this color after
|
|
328
|
+
* converting this color to the specified `space`, with [missing channels]
|
|
329
|
+
* converted to `0`.
|
|
330
|
+
*
|
|
331
|
+
* [missing channels]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
332
|
+
*
|
|
333
|
+
* @throws `Error` if `channel` is not `alpha` or a channel in `space`.
|
|
334
|
+
*/
|
|
335
|
+
channel(channel: ChannelNameHsl, options: {space: ColorSpaceHsl}): number;
|
|
336
|
+
channel(channel: ChannelNameHwb, options: {space: ColorSpaceHwb}): number;
|
|
337
|
+
channel(channel: ChannelNameLab, options: {space: ColorSpaceLab}): number;
|
|
338
|
+
channel(channel: ChannelNameLch, options: {space: ColorSpaceLch}): number;
|
|
339
|
+
channel(channel: ChannelNameRgb, options: {space: ColorSpaceRgb}): number;
|
|
340
|
+
channel(channel: ChannelNameXyz, options: {space: ColorSpaceXyz}): number;
|
|
95
341
|
|
|
96
342
|
/** This color's alpha channel, between `0` and `1`. */
|
|
97
343
|
get alpha(): number;
|
|
98
344
|
|
|
99
345
|
/**
|
|
100
|
-
*
|
|
346
|
+
* Returns a boolean indicating whether a given channel value is a [missing
|
|
347
|
+
* channel].
|
|
348
|
+
*
|
|
349
|
+
* [missing channel]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
|
101
350
|
*/
|
|
102
|
-
|
|
103
|
-
red?: number;
|
|
104
|
-
green?: number;
|
|
105
|
-
blue?: number;
|
|
106
|
-
alpha?: number;
|
|
107
|
-
}): SassColor;
|
|
351
|
+
isChannelMissing(channel: ChannelName): boolean;
|
|
108
352
|
|
|
109
353
|
/**
|
|
110
|
-
*
|
|
354
|
+
* Returns a boolean indicating whether a given `channel` is [powerless] in
|
|
355
|
+
* this color. This is a special state that's defined for individual color
|
|
356
|
+
* spaces, which indicates that a channel's value won't affect how a color is
|
|
357
|
+
* displayed.
|
|
358
|
+
*
|
|
359
|
+
* [powerless]: https://www.w3.org/TR/css-color-4/#powerless
|
|
111
360
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
361
|
+
isChannelPowerless(channel: ChannelName): boolean;
|
|
362
|
+
isChannelPowerless(
|
|
363
|
+
channel: ChannelNameHsl,
|
|
364
|
+
options?: {space: ColorSpaceHsl}
|
|
365
|
+
): boolean;
|
|
366
|
+
isChannelPowerless(
|
|
367
|
+
channel: ChannelNameHwb,
|
|
368
|
+
options?: {space: ColorSpaceHwb}
|
|
369
|
+
): boolean;
|
|
370
|
+
isChannelPowerless(
|
|
371
|
+
channel: ChannelNameLab,
|
|
372
|
+
options?: {space: ColorSpaceLab}
|
|
373
|
+
): boolean;
|
|
374
|
+
isChannelPowerless(
|
|
375
|
+
channel: ChannelNameLch,
|
|
376
|
+
options?: {space: ColorSpaceLch}
|
|
377
|
+
): boolean;
|
|
378
|
+
isChannelPowerless(
|
|
379
|
+
channel: ChannelNameRgb,
|
|
380
|
+
options?: {space: ColorSpaceRgb}
|
|
381
|
+
): boolean;
|
|
382
|
+
isChannelPowerless(
|
|
383
|
+
channel: ChannelNameXyz,
|
|
384
|
+
options?: {space: ColorSpaceXyz}
|
|
385
|
+
): boolean;
|
|
118
386
|
|
|
119
387
|
/**
|
|
120
|
-
*
|
|
388
|
+
* Returns a color partway between this color and `color2` according to
|
|
389
|
+
* `method`, as defined by the CSS Color 4 [color interpolation] procedure.
|
|
390
|
+
*
|
|
391
|
+
* [color interpolation]: https://www.w3.org/TR/css-color-4/#interpolation
|
|
392
|
+
*
|
|
393
|
+
* If `method` is missing and this color is in a rectangular color space (Lab,
|
|
394
|
+
* Oklab, RGB, and XYZ spaces), `method` defaults to the color space of this
|
|
395
|
+
* color. Otherwise, `method` defaults to a space separated list containing
|
|
396
|
+
* the color space of this color and the string "shorter".
|
|
397
|
+
*
|
|
398
|
+
* The `weight` is a number between 0 and 1 that indicates how much of this
|
|
399
|
+
* color should be in the resulting color. If omitted, it defaults to 0.5.
|
|
121
400
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
401
|
+
interpolate(
|
|
402
|
+
color2: SassColor,
|
|
403
|
+
options?: {
|
|
404
|
+
weight?: number;
|
|
405
|
+
method?: HueInterpolationMethod;
|
|
406
|
+
}
|
|
407
|
+
): SassColor;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Returns a new color that's the result of changing one or more of this
|
|
411
|
+
* color's HSL channels.
|
|
412
|
+
*
|
|
413
|
+
* @throws `Error` if `space` is missing and this color is not in a legacy
|
|
414
|
+
* color space (`rgb`, `hsl`, or `hwb`).
|
|
415
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
416
|
+
* and `1`.
|
|
417
|
+
*/
|
|
418
|
+
change(
|
|
419
|
+
options: {
|
|
420
|
+
[key in ChannelNameHsl]?: number | null;
|
|
421
|
+
} & {
|
|
422
|
+
space?: ColorSpaceHsl;
|
|
423
|
+
}
|
|
424
|
+
): SassColor;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Returns a new color that's the result of changing one or more of this
|
|
428
|
+
* color's HWB channels.
|
|
429
|
+
*
|
|
430
|
+
* @throws `Error` if `space` is missing and this color is not in a legacy
|
|
431
|
+
* color space (`rgb`, `hsl`, or `hwb`).
|
|
432
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
433
|
+
* and `1`.
|
|
434
|
+
*/
|
|
435
|
+
change(
|
|
436
|
+
options: {
|
|
437
|
+
[key in ChannelNameHwb]?: number | null;
|
|
438
|
+
} & {
|
|
439
|
+
space?: ColorSpaceHwb;
|
|
440
|
+
}
|
|
441
|
+
): SassColor;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Returns a new color that's the result of changing one or more of this
|
|
445
|
+
* color's Lab channels.
|
|
446
|
+
*
|
|
447
|
+
* @throws `Error` if `space` is missing and this color is not in the Lab or
|
|
448
|
+
* Oklab color spaces.
|
|
449
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
450
|
+
* and `1`.
|
|
451
|
+
*/
|
|
452
|
+
change(
|
|
453
|
+
options: {
|
|
454
|
+
[key in ChannelNameLab]?: number | null;
|
|
455
|
+
} & {
|
|
456
|
+
space?: ColorSpaceLab;
|
|
457
|
+
}
|
|
458
|
+
): SassColor;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Returns a new color that's the result of changing one or more of this
|
|
462
|
+
* color's LCH channels.
|
|
463
|
+
*
|
|
464
|
+
* @throws `Error` if `space` is missing and this color is not in the LCH or
|
|
465
|
+
* Oklch color spaces.
|
|
466
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
467
|
+
* and `1`.
|
|
468
|
+
*/
|
|
469
|
+
change(
|
|
470
|
+
options: {
|
|
471
|
+
[key in ChannelNameLch]?: number | null;
|
|
472
|
+
} & {
|
|
473
|
+
space?: ColorSpaceLch;
|
|
474
|
+
}
|
|
475
|
+
): SassColor;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Returns a new color that's the result of changing one or more of this
|
|
479
|
+
* color's RGB channels.
|
|
480
|
+
*
|
|
481
|
+
* @throws `Error` if `space` is missing and this color is not in a legacy
|
|
482
|
+
* color space (`rgb`, `hsl`, or `hwb`).
|
|
483
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
484
|
+
* and `1`.
|
|
485
|
+
*/
|
|
486
|
+
change(
|
|
487
|
+
options: {
|
|
488
|
+
[key in ChannelNameRgb]?: number | null;
|
|
489
|
+
} & {
|
|
490
|
+
space?: ColorSpaceRgb;
|
|
491
|
+
}
|
|
492
|
+
): SassColor;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Returns a new color that's the result of changing one or more of this
|
|
496
|
+
* color's XYZ channels.
|
|
497
|
+
*
|
|
498
|
+
* @throws `Error` if `space` is missing and this color is not in an XYZ color
|
|
499
|
+
* space.
|
|
500
|
+
* @throws `Error` if `alpha` is set and isn't `null` or a number between `0`
|
|
501
|
+
* and `1`.
|
|
502
|
+
*/
|
|
503
|
+
change(
|
|
504
|
+
options: {
|
|
505
|
+
[key in ChannelNameXyz]?: number | null;
|
|
506
|
+
} & {
|
|
507
|
+
space?: ColorSpaceXyz;
|
|
508
|
+
}
|
|
509
|
+
): SassColor;
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* This color's red channel in the RGB color space.
|
|
513
|
+
*
|
|
514
|
+
* @deprecated Use {@link channel} instead.
|
|
515
|
+
*/
|
|
516
|
+
get red(): number;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* This color's green channel in the RGB color space.
|
|
520
|
+
*
|
|
521
|
+
* @deprecated Use {@link channel} instead.
|
|
522
|
+
*/
|
|
523
|
+
get green(): number;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* This color's blue channel in the RGB color space.
|
|
527
|
+
*
|
|
528
|
+
* @deprecated Use {@link channel} instead.
|
|
529
|
+
*/
|
|
530
|
+
get blue(): number;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* This color's hue in the HSL color space.
|
|
534
|
+
*
|
|
535
|
+
* @deprecated Use {@link channel} instead.
|
|
536
|
+
*/
|
|
537
|
+
get hue(): number;
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* This color's saturation in the HSL color space.
|
|
541
|
+
*
|
|
542
|
+
* @deprecated Use {@link channel} instead.
|
|
543
|
+
*/
|
|
544
|
+
get saturation(): number;
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* This color's lightness in the HSL color space.
|
|
548
|
+
*
|
|
549
|
+
* @deprecated Use {@link channel} instead.
|
|
550
|
+
*/
|
|
551
|
+
get lightness(): number;
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* This color's whiteness in the HWB color space.
|
|
555
|
+
*
|
|
556
|
+
* @deprecated Use {@link channel} instead.
|
|
557
|
+
*/
|
|
558
|
+
get whiteness(): number;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* This color's blackness in the HWB color space.
|
|
562
|
+
*
|
|
563
|
+
* @deprecated Use {@link channel} instead.
|
|
564
|
+
*/
|
|
565
|
+
get blackness(): number;
|
|
128
566
|
}
|
package/types/value/index.d.ts
CHANGED
|
@@ -19,7 +19,27 @@ export {
|
|
|
19
19
|
CalculationOperation,
|
|
20
20
|
CalculationInterpolation,
|
|
21
21
|
} from './calculation';
|
|
22
|
-
export {
|
|
22
|
+
export {
|
|
23
|
+
SassColor,
|
|
24
|
+
ColorSpaceHsl,
|
|
25
|
+
ChannelNameHsl,
|
|
26
|
+
ColorSpaceHwb,
|
|
27
|
+
ChannelNameHwb,
|
|
28
|
+
ColorSpaceLab,
|
|
29
|
+
ChannelNameLab,
|
|
30
|
+
ColorSpaceLch,
|
|
31
|
+
ChannelNameLch,
|
|
32
|
+
ColorSpaceRgb,
|
|
33
|
+
ChannelNameRgb,
|
|
34
|
+
ColorSpaceXyz,
|
|
35
|
+
ChannelNameXyz,
|
|
36
|
+
ChannelName,
|
|
37
|
+
GamutMapMethod,
|
|
38
|
+
KnownColorSpace,
|
|
39
|
+
PolarColorSpace,
|
|
40
|
+
RectangularColorSpace,
|
|
41
|
+
HueInterpolationMethod,
|
|
42
|
+
} from './color';
|
|
23
43
|
export {SassFunction} from './function';
|
|
24
44
|
export {SassList, ListSeparator} from './list';
|
|
25
45
|
export {SassMap} from './map';
|