@zag-js/color-utils 1.46.0 → 1.48.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.
Files changed (50) hide show
  1. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.js +11 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.mjs +11 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.js +13 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.mjs +13 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.js +8 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.mjs +8 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.js +15 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.mjs +10 -0
  9. package/dist/area-gradient.d.mts +9 -11
  10. package/dist/area-gradient.d.ts +9 -11
  11. package/dist/area-gradient.js +53 -84
  12. package/dist/area-gradient.mjs +49 -71
  13. package/dist/color-format-gradient.d.mts +58 -60
  14. package/dist/color-format-gradient.d.ts +58 -60
  15. package/dist/color-format-gradient.js +93 -154
  16. package/dist/color-format-gradient.mjs +81 -123
  17. package/dist/color.d.mts +20 -23
  18. package/dist/color.d.ts +20 -23
  19. package/dist/color.js +57 -83
  20. package/dist/color.mjs +53 -60
  21. package/dist/hsb-color.d.mts +32 -35
  22. package/dist/hsb-color.d.ts +32 -35
  23. package/dist/hsb-color.js +135 -163
  24. package/dist/hsb-color.mjs +129 -138
  25. package/dist/hsl-color.d.mts +33 -36
  26. package/dist/hsl-color.d.ts +33 -36
  27. package/dist/hsl-color.js +137 -165
  28. package/dist/hsl-color.mjs +130 -139
  29. package/dist/index.d.mts +5 -4
  30. package/dist/index.d.ts +5 -4
  31. package/dist/index.js +10 -37
  32. package/dist/index.mjs +1 -9
  33. package/dist/native-color.d.mts +1 -3
  34. package/dist/native-color.d.ts +1 -3
  35. package/dist/native-color.js +16 -39
  36. package/dist/native-color.mjs +12 -16
  37. package/dist/parse-color.d.mts +3 -6
  38. package/dist/parse-color.d.ts +3 -6
  39. package/dist/parse-color.js +21 -47
  40. package/dist/parse-color.mjs +13 -20
  41. package/dist/rgb-color.d.mts +33 -36
  42. package/dist/rgb-color.d.ts +33 -36
  43. package/dist/rgb-color.js +174 -211
  44. package/dist/rgb-color.mjs +168 -186
  45. package/dist/types.d.mts +82 -84
  46. package/dist/types.d.ts +82 -84
  47. package/dist/types.js +4 -18
  48. package/dist/types.mjs +1 -0
  49. package/package.json +4 -4
  50. package/dist/chunk-QZ7TP4HQ.mjs +0 -7
@@ -1,190 +1,172 @@
1
- import {
2
- __publicField
3
- } from "./chunk-QZ7TP4HQ.mjs";
4
-
5
- // src/rgb-color.ts
6
- import { clampValue, toFixedNumber } from "@zag-js/utils";
7
1
  import { Color } from "./color.mjs";
8
2
  import { HSBColor } from "./hsb-color.mjs";
9
3
  import { HSLColor } from "./hsl-color.mjs";
10
- var HEX_COLOR_REGEX = /^#[\da-f]+$/i;
11
- var RGB_COLOR_REGEX = /^rgba?\((.*)\)$/;
12
- var HEX_STARTING_REGEX = /[^#]/gi;
13
- var _RGBColor = class _RGBColor extends Color {
14
- constructor(red, green, blue, alpha) {
15
- super();
16
- __publicField(this, "red", red);
17
- __publicField(this, "green", green);
18
- __publicField(this, "blue", blue);
19
- __publicField(this, "alpha", alpha);
20
- }
21
- static parse(value) {
22
- let colors = [];
23
- if (HEX_COLOR_REGEX.test(value) && [4, 5, 7, 9].includes(value.length)) {
24
- const values = (value.length < 6 ? value.replace(HEX_STARTING_REGEX, "$&$&") : value).slice(1).split("");
25
- while (values.length > 0) {
26
- colors.push(parseInt(values.splice(0, 2).join(""), 16));
27
- }
28
- colors[3] = colors[3] !== void 0 ? colors[3] / 255 : void 0;
29
- }
30
- const match = value.match(RGB_COLOR_REGEX);
31
- if (match?.[1]) {
32
- colors = match[1].split(",").map((value2) => Number(value2.trim())).map((num, i) => clampValue(num, 0, i < 3 ? 255 : 1));
33
- }
34
- return colors.length < 3 ? void 0 : new _RGBColor(colors[0], colors[1], colors[2], colors[3] ?? 1);
35
- }
36
- toString(format = "css") {
37
- switch (format) {
38
- case "hex":
39
- return "#" + (this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0")).toUpperCase();
40
- case "hexa":
41
- return "#" + (this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0") + Math.round(this.alpha * 255).toString(16).padStart(2, "0")).toUpperCase();
42
- case "rgb":
43
- return `rgb(${this.red}, ${this.green}, ${this.blue})`;
44
- case "css":
45
- case "rgba":
46
- return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
47
- case "hsl":
48
- return this.toHSL().toString("hsl");
49
- case "hsb":
50
- return this.toHSB().toString("hsb");
51
- default:
52
- return this.toFormat(format).toString(format);
53
- }
54
- }
55
- toFormat(format) {
56
- switch (format) {
57
- case "rgba":
58
- return this;
59
- case "hsba":
60
- return this.toHSB();
61
- case "hsla":
62
- return this.toHSL();
63
- default:
64
- throw new Error("Unsupported color conversion: rgb -> " + format);
65
- }
66
- }
67
- toHexInt() {
68
- return this.red << 16 | this.green << 8 | this.blue;
69
- }
70
- /**
71
- * Converts an RGB color value to HSB.
72
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
73
- * @returns An HSBColor object.
74
- */
75
- toHSB() {
76
- const red = this.red / 255;
77
- const green = this.green / 255;
78
- const blue = this.blue / 255;
79
- const min = Math.min(red, green, blue);
80
- const brightness = Math.max(red, green, blue);
81
- const chroma = brightness - min;
82
- const saturation = brightness === 0 ? 0 : chroma / brightness;
83
- let hue = 0;
84
- if (chroma !== 0) {
85
- switch (brightness) {
86
- case red:
87
- hue = (green - blue) / chroma + (green < blue ? 6 : 0);
88
- break;
89
- case green:
90
- hue = (blue - red) / chroma + 2;
91
- break;
92
- case blue:
93
- hue = (red - green) / chroma + 4;
94
- break;
95
- }
96
- hue /= 6;
97
- }
98
- return new HSBColor(
99
- toFixedNumber(hue * 360, 2),
100
- toFixedNumber(saturation * 100, 2),
101
- toFixedNumber(brightness * 100, 2),
102
- toFixedNumber(this.alpha, 2)
103
- );
104
- }
105
- /**
106
- * Converts an RGB color value to HSL.
107
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
108
- * @returns An HSLColor object.
109
- */
110
- toHSL() {
111
- const red = this.red / 255;
112
- const green = this.green / 255;
113
- const blue = this.blue / 255;
114
- const min = Math.min(red, green, blue);
115
- const max = Math.max(red, green, blue);
116
- const lightness = (max + min) / 2;
117
- const chroma = max - min;
118
- let hue = -1;
119
- let saturation = -1;
120
- if (chroma === 0) {
121
- hue = saturation = 0;
122
- } else {
123
- saturation = chroma / (lightness < 0.5 ? max + min : 2 - max - min);
124
- switch (max) {
125
- case red:
126
- hue = (green - blue) / chroma + (green < blue ? 6 : 0);
127
- break;
128
- case green:
129
- hue = (blue - red) / chroma + 2;
130
- break;
131
- case blue:
132
- hue = (red - green) / chroma + 4;
133
- break;
134
- }
135
- hue /= 6;
136
- }
137
- return new HSLColor(
138
- toFixedNumber(hue * 360, 2),
139
- toFixedNumber(saturation * 100, 2),
140
- toFixedNumber(lightness * 100, 2),
141
- toFixedNumber(this.alpha, 2)
142
- );
143
- }
144
- clone() {
145
- return new _RGBColor(this.red, this.green, this.blue, this.alpha);
146
- }
147
- getChannelFormatOptions(channel) {
148
- switch (channel) {
149
- case "red":
150
- case "green":
151
- case "blue":
152
- return { style: "decimal" };
153
- case "alpha":
154
- return { style: "percent" };
155
- default:
156
- throw new Error("Unknown color channel: " + channel);
157
- }
158
- }
159
- formatChannelValue(channel, locale) {
160
- let options = this.getChannelFormatOptions(channel);
161
- let value = this.getChannelValue(channel);
162
- return new Intl.NumberFormat(locale, options).format(value);
163
- }
164
- getChannelRange(channel) {
165
- switch (channel) {
166
- case "red":
167
- case "green":
168
- case "blue":
169
- return { minValue: 0, maxValue: 255, step: 1, pageSize: 17 };
170
- case "alpha":
171
- return { minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1 };
172
- default:
173
- throw new Error("Unknown color channel: " + channel);
174
- }
175
- }
176
- toJSON() {
177
- return { r: this.red, g: this.green, b: this.blue, a: this.alpha };
178
- }
179
- getFormat() {
180
- return "rgba";
181
- }
182
- getChannels() {
183
- return _RGBColor.colorChannels;
184
- }
185
- };
186
- __publicField(_RGBColor, "colorChannels", ["red", "green", "blue"]);
187
- var RGBColor = _RGBColor;
188
- export {
189
- RGBColor
4
+ import _defineProperty from "./_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.mjs";
5
+ import { clampValue, toFixedNumber } from "@zag-js/utils";
6
+ // src/rgb-color.ts
7
+ const HEX_COLOR_REGEX = /^#[\da-f]+$/i;
8
+ const RGB_COLOR_REGEX = /^rgba?\((.*)\)$/;
9
+ const HEX_STARTING_REGEX = /[^#]/gi;
10
+ var RGBColor = class RGBColor extends Color {
11
+ constructor(red, green, blue, alpha) {
12
+ super();
13
+ this.red = red;
14
+ this.green = green;
15
+ this.blue = blue;
16
+ this.alpha = alpha;
17
+ }
18
+ static parse(value) {
19
+ let colors = [];
20
+ if (HEX_COLOR_REGEX.test(value) && [
21
+ 4,
22
+ 5,
23
+ 7,
24
+ 9
25
+ ].includes(value.length)) {
26
+ const values = (value.length < 6 ? value.replace(HEX_STARTING_REGEX, "$&$&") : value).slice(1).split("");
27
+ while (values.length > 0) colors.push(parseInt(values.splice(0, 2).join(""), 16));
28
+ colors[3] = colors[3] !== void 0 ? colors[3] / 255 : void 0;
29
+ }
30
+ const match = value.match(RGB_COLOR_REGEX);
31
+ if (match?.[1]) colors = match[1].split(",").map((value) => Number(value.trim())).map((num, i) => clampValue(num, 0, i < 3 ? 255 : 1));
32
+ return colors.length < 3 ? void 0 : new RGBColor(colors[0], colors[1], colors[2], colors[3] ?? 1);
33
+ }
34
+ toString(format = "css") {
35
+ switch (format) {
36
+ case "hex": return "#" + (this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0")).toUpperCase();
37
+ case "hexa": return "#" + (this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0") + Math.round(this.alpha * 255).toString(16).padStart(2, "0")).toUpperCase();
38
+ case "rgb": return `rgb(${this.red}, ${this.green}, ${this.blue})`;
39
+ case "css":
40
+ case "rgba": return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
41
+ case "hsl": return this.toHSL().toString("hsl");
42
+ case "hsb": return this.toHSB().toString("hsb");
43
+ default: return this.toFormat(format).toString(format);
44
+ }
45
+ }
46
+ toFormat(format) {
47
+ switch (format) {
48
+ case "rgba": return this;
49
+ case "hsba": return this.toHSB();
50
+ case "hsla": return this.toHSL();
51
+ default: throw new Error("Unsupported color conversion: rgb -> " + format);
52
+ }
53
+ }
54
+ toHexInt() {
55
+ return this.red << 16 | this.green << 8 | this.blue;
56
+ }
57
+ /**
58
+ * Converts an RGB color value to HSB.
59
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
60
+ * @returns An HSBColor object.
61
+ */
62
+ toHSB() {
63
+ const red = this.red / 255;
64
+ const green = this.green / 255;
65
+ const blue = this.blue / 255;
66
+ const min = Math.min(red, green, blue);
67
+ const brightness = Math.max(red, green, blue);
68
+ const chroma = brightness - min;
69
+ const saturation = brightness === 0 ? 0 : chroma / brightness;
70
+ let hue = 0;
71
+ if (chroma !== 0) {
72
+ switch (brightness) {
73
+ case red:
74
+ hue = (green - blue) / chroma + (green < blue ? 6 : 0);
75
+ break;
76
+ case green:
77
+ hue = (blue - red) / chroma + 2;
78
+ break;
79
+ case blue: hue = (red - green) / chroma + 4;
80
+ }
81
+ hue /= 6;
82
+ }
83
+ return new HSBColor(toFixedNumber(hue * 360, 2), toFixedNumber(saturation * 100, 2), toFixedNumber(brightness * 100, 2), toFixedNumber(this.alpha, 2));
84
+ }
85
+ /**
86
+ * Converts an RGB color value to HSL.
87
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
88
+ * @returns An HSLColor object.
89
+ */
90
+ toHSL() {
91
+ const red = this.red / 255;
92
+ const green = this.green / 255;
93
+ const blue = this.blue / 255;
94
+ const min = Math.min(red, green, blue);
95
+ const max = Math.max(red, green, blue);
96
+ const lightness = (max + min) / 2;
97
+ const chroma = max - min;
98
+ let hue = -1;
99
+ let saturation = -1;
100
+ if (chroma === 0) hue = saturation = 0;
101
+ else {
102
+ saturation = chroma / (lightness < .5 ? max + min : 2 - max - min);
103
+ switch (max) {
104
+ case red:
105
+ hue = (green - blue) / chroma + (green < blue ? 6 : 0);
106
+ break;
107
+ case green:
108
+ hue = (blue - red) / chroma + 2;
109
+ break;
110
+ case blue: hue = (red - green) / chroma + 4;
111
+ }
112
+ hue /= 6;
113
+ }
114
+ return new HSLColor(toFixedNumber(hue * 360, 2), toFixedNumber(saturation * 100, 2), toFixedNumber(lightness * 100, 2), toFixedNumber(this.alpha, 2));
115
+ }
116
+ clone() {
117
+ return new RGBColor(this.red, this.green, this.blue, this.alpha);
118
+ }
119
+ getChannelFormatOptions(channel) {
120
+ switch (channel) {
121
+ case "red":
122
+ case "green":
123
+ case "blue": return { style: "decimal" };
124
+ case "alpha": return { style: "percent" };
125
+ default: throw new Error("Unknown color channel: " + channel);
126
+ }
127
+ }
128
+ formatChannelValue(channel, locale) {
129
+ let options = this.getChannelFormatOptions(channel);
130
+ let value = this.getChannelValue(channel);
131
+ return new Intl.NumberFormat(locale, options).format(value);
132
+ }
133
+ getChannelRange(channel) {
134
+ switch (channel) {
135
+ case "red":
136
+ case "green":
137
+ case "blue": return {
138
+ minValue: 0,
139
+ maxValue: 255,
140
+ step: 1,
141
+ pageSize: 17
142
+ };
143
+ case "alpha": return {
144
+ minValue: 0,
145
+ maxValue: 1,
146
+ step: .01,
147
+ pageSize: .1
148
+ };
149
+ default: throw new Error("Unknown color channel: " + channel);
150
+ }
151
+ }
152
+ toJSON() {
153
+ return {
154
+ r: this.red,
155
+ g: this.green,
156
+ b: this.blue,
157
+ a: this.alpha
158
+ };
159
+ }
160
+ getFormat() {
161
+ return "rgba";
162
+ }
163
+ getChannels() {
164
+ return RGBColor.colorChannels;
165
+ }
190
166
  };
167
+ _defineProperty(RGBColor, "colorChannels", [
168
+ "red",
169
+ "green",
170
+ "blue"
171
+ ]);
172
+ export { RGBColor };
package/dist/types.d.mts CHANGED
@@ -1,87 +1,85 @@
1
- type ColorHexFormat = "hex" | "hexa";
2
- type ColorFormat = "rgba" | "hsla" | "hsba";
3
- type ColorStringFormat = ColorHexFormat | ColorFormat | "rgb" | "hsl" | "hsb" | "css";
4
- type ColorChannel = "hue" | "saturation" | "brightness" | "lightness" | "red" | "green" | "blue" | "alpha";
5
- interface Color2DAxes {
6
- xChannel: ColorChannel;
7
- yChannel: ColorChannel;
1
+ export type ColorHexFormat = "hex" | "hexa";
2
+ export type ColorFormat = "rgba" | "hsla" | "hsba";
3
+ export type ColorStringFormat = ColorHexFormat | ColorFormat | "rgb" | "hsl" | "hsb" | "css";
4
+ export type ColorChannel = "hue" | "saturation" | "brightness" | "lightness" | "red" | "green" | "blue" | "alpha";
5
+ export interface Color2DAxes {
6
+ xChannel: ColorChannel;
7
+ yChannel: ColorChannel;
8
8
  }
9
- interface ColorAxes extends Color2DAxes {
10
- zChannel: ColorChannel;
9
+ export interface ColorAxes extends Color2DAxes {
10
+ zChannel: ColorChannel;
11
11
  }
12
- interface ColorChannelRange {
13
- /** The minimum value of the color channel. */
14
- minValue: number;
15
- /** The maximum value of the color channel. */
16
- maxValue: number;
17
- /** The step value of the color channel, used when incrementing and decrementing. */
18
- step: number;
19
- /** The page step value of the color channel, used when incrementing and decrementing. */
20
- pageSize: number;
12
+ export interface ColorChannelRange {
13
+ /** The minimum value of the color channel. */
14
+ minValue: number;
15
+ /** The maximum value of the color channel. */
16
+ maxValue: number;
17
+ /** The step value of the color channel, used when incrementing and decrementing. */
18
+ step: number;
19
+ /** The page step value of the color channel, used when incrementing and decrementing. */
20
+ pageSize: number;
21
21
  }
22
- interface ColorType {
23
- /** Converts the color to the given color format, and returns a new Color object. */
24
- toFormat(format: ColorFormat): ColorType;
25
- /** Converts the color to a JSON object. */
26
- toJSON(): Record<string, number>;
27
- /** Converts the color to a string in the given format. Defaults to CSS format. */
28
- toString(format?: ColorStringFormat): string;
29
- /** Converts the color to hex, and returns an integer representation. */
30
- toHexInt(): number;
31
- /**
32
- * Returns the numeric value for a given channel.
33
- * Throws an error if the channel is unsupported in the current color format.
34
- */
35
- getChannelValue(channel: ColorChannel): number;
36
- /**
37
- * Sets the numeric value for a given channel, and returns a new Color object.
38
- * Throws an error if the channel is unsupported in the current color format.
39
- */
40
- withChannelValue(channel: ColorChannel, value: number): ColorType;
41
- /**
42
- * Returns the formatted value for a given channel.
43
- */
44
- formatChannelValue(channel: ColorChannel, locale: string): string;
45
- /**
46
- * Returns the minimum, maximum, and step values for a given channel.
47
- */
48
- getChannelRange(channel: ColorChannel): ColorChannelRange;
49
- /**
50
- * Returns the color space, 'rgb', 'hsb' or 'hsl', for the current color.
51
- */
52
- getFormat(): ColorFormat;
53
- /**
54
- * Returns the color space axes, xChannel, yChannel, zChannel.
55
- */
56
- getColorAxes(xyChannels: Color2DAxes): ColorAxes;
57
- /**
58
- * Returns an array of the color channels within the current color space space.
59
- */
60
- getChannels(): [ColorChannel, ColorChannel, ColorChannel];
61
- /**
62
- * Returns a new Color object with the same values as the current color.
63
- */
64
- clone(): ColorType;
65
- /**
66
- * Whether the color is equal to another color.
67
- */
68
- isEqual(color: ColorType): boolean;
69
- /**
70
- * Increments the color channel by the given step size, and returns a new Color object.
71
- */
72
- incrementChannel(channel: ColorChannel, stepSize: number): ColorType;
73
- /**
74
- * Decrements the color channel by the given step size, and returns a new Color object.
75
- */
76
- decrementChannel(channel: ColorChannel, stepSize: number): ColorType;
77
- /**
78
- * Returns the color channel value as a percentage of the channel range.
79
- */
80
- getChannelValuePercent(channel: ColorChannel, value?: number): number;
81
- /**
82
- * Returns the color channel value for a given percentage of the channel range.
83
- */
84
- getChannelPercentValue(channel: ColorChannel, percent: number): number;
85
- }
86
-
87
- export type { Color2DAxes, ColorAxes, ColorChannel, ColorChannelRange, ColorFormat, ColorHexFormat, ColorStringFormat, ColorType };
22
+ export interface ColorType {
23
+ /** Converts the color to the given color format, and returns a new Color object. */
24
+ toFormat(format: ColorFormat): ColorType;
25
+ /** Converts the color to a JSON object. */
26
+ toJSON(): Record<string, number>;
27
+ /** Converts the color to a string in the given format. Defaults to CSS format. */
28
+ toString(format?: ColorStringFormat): string;
29
+ /** Converts the color to hex, and returns an integer representation. */
30
+ toHexInt(): number;
31
+ /**
32
+ * Returns the numeric value for a given channel.
33
+ * Throws an error if the channel is unsupported in the current color format.
34
+ */
35
+ getChannelValue(channel: ColorChannel): number;
36
+ /**
37
+ * Sets the numeric value for a given channel, and returns a new Color object.
38
+ * Throws an error if the channel is unsupported in the current color format.
39
+ */
40
+ withChannelValue(channel: ColorChannel, value: number): ColorType;
41
+ /**
42
+ * Returns the formatted value for a given channel.
43
+ */
44
+ formatChannelValue(channel: ColorChannel, locale: string): string;
45
+ /**
46
+ * Returns the minimum, maximum, and step values for a given channel.
47
+ */
48
+ getChannelRange(channel: ColorChannel): ColorChannelRange;
49
+ /**
50
+ * Returns the color space, 'rgb', 'hsb' or 'hsl', for the current color.
51
+ */
52
+ getFormat(): ColorFormat;
53
+ /**
54
+ * Returns the color space axes, xChannel, yChannel, zChannel.
55
+ */
56
+ getColorAxes(xyChannels: Color2DAxes): ColorAxes;
57
+ /**
58
+ * Returns an array of the color channels within the current color space space.
59
+ */
60
+ getChannels(): [ColorChannel, ColorChannel, ColorChannel];
61
+ /**
62
+ * Returns a new Color object with the same values as the current color.
63
+ */
64
+ clone(): ColorType;
65
+ /**
66
+ * Whether the color is equal to another color.
67
+ */
68
+ isEqual(color: ColorType): boolean;
69
+ /**
70
+ * Increments the color channel by the given step size, and returns a new Color object.
71
+ */
72
+ incrementChannel(channel: ColorChannel, stepSize: number): ColorType;
73
+ /**
74
+ * Decrements the color channel by the given step size, and returns a new Color object.
75
+ */
76
+ decrementChannel(channel: ColorChannel, stepSize: number): ColorType;
77
+ /**
78
+ * Returns the color channel value as a percentage of the channel range.
79
+ */
80
+ getChannelValuePercent(channel: ColorChannel, value?: number): number;
81
+ /**
82
+ * Returns the color channel value for a given percentage of the channel range.
83
+ */
84
+ getChannelPercentValue(channel: ColorChannel, percent: number): number;
85
+ }