@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
package/dist/color.d.mts CHANGED
@@ -1,23 +1,20 @@
1
- import { ColorType, ColorFormat, ColorStringFormat, ColorChannel, ColorChannelRange, Color2DAxes, ColorAxes } from './types.mjs';
2
-
3
- declare abstract class Color implements ColorType {
4
- abstract toFormat(format: ColorFormat): ColorType;
5
- abstract toJSON(): Record<string, number>;
6
- abstract toString(format?: ColorStringFormat): string;
7
- abstract clone(): ColorType;
8
- abstract getChannelRange(channel: ColorChannel): ColorChannelRange;
9
- abstract getFormat(): ColorFormat;
10
- abstract getChannels(): [ColorChannel, ColorChannel, ColorChannel];
11
- abstract formatChannelValue(channel: ColorChannel, locale: string): string;
12
- toHexInt(): number;
13
- getChannelValue(channel: ColorChannel): number;
14
- getChannelValuePercent(channel: ColorChannel, valueToCheck?: number): number;
15
- getChannelPercentValue(channel: ColorChannel, percentToCheck: number): number;
16
- withChannelValue(channel: ColorChannel, value: number): ColorType;
17
- getColorAxes(xyChannels: Color2DAxes): ColorAxes;
18
- incrementChannel(channel: ColorChannel, stepSize: number): ColorType;
19
- decrementChannel(channel: ColorChannel, stepSize: number): ColorType;
20
- isEqual(color: ColorType): boolean;
21
- }
22
-
23
- export { Color };
1
+ import { Color2DAxes, ColorAxes, ColorChannel, ColorChannelRange, ColorFormat, ColorStringFormat, ColorType } from "./types.mjs";
2
+ export declare abstract class Color implements ColorType {
3
+ abstract toFormat(format: ColorFormat): ColorType;
4
+ abstract toJSON(): Record<string, number>;
5
+ abstract toString(format?: ColorStringFormat): string;
6
+ abstract clone(): ColorType;
7
+ abstract getChannelRange(channel: ColorChannel): ColorChannelRange;
8
+ abstract getFormat(): ColorFormat;
9
+ abstract getChannels(): [ColorChannel, ColorChannel, ColorChannel];
10
+ abstract formatChannelValue(channel: ColorChannel, locale: string): string;
11
+ toHexInt(): number;
12
+ getChannelValue(channel: ColorChannel): number;
13
+ getChannelValuePercent(channel: ColorChannel, valueToCheck?: number): number;
14
+ getChannelPercentValue(channel: ColorChannel, percentToCheck: number): number;
15
+ withChannelValue(channel: ColorChannel, value: number): ColorType;
16
+ getColorAxes(xyChannels: Color2DAxes): ColorAxes;
17
+ incrementChannel(channel: ColorChannel, stepSize: number): ColorType;
18
+ decrementChannel(channel: ColorChannel, stepSize: number): ColorType;
19
+ isEqual(color: ColorType): boolean;
20
+ }
package/dist/color.d.ts CHANGED
@@ -1,23 +1,20 @@
1
- import { ColorType, ColorFormat, ColorStringFormat, ColorChannel, ColorChannelRange, Color2DAxes, ColorAxes } from './types.js';
2
-
3
- declare abstract class Color implements ColorType {
4
- abstract toFormat(format: ColorFormat): ColorType;
5
- abstract toJSON(): Record<string, number>;
6
- abstract toString(format?: ColorStringFormat): string;
7
- abstract clone(): ColorType;
8
- abstract getChannelRange(channel: ColorChannel): ColorChannelRange;
9
- abstract getFormat(): ColorFormat;
10
- abstract getChannels(): [ColorChannel, ColorChannel, ColorChannel];
11
- abstract formatChannelValue(channel: ColorChannel, locale: string): string;
12
- toHexInt(): number;
13
- getChannelValue(channel: ColorChannel): number;
14
- getChannelValuePercent(channel: ColorChannel, valueToCheck?: number): number;
15
- getChannelPercentValue(channel: ColorChannel, percentToCheck: number): number;
16
- withChannelValue(channel: ColorChannel, value: number): ColorType;
17
- getColorAxes(xyChannels: Color2DAxes): ColorAxes;
18
- incrementChannel(channel: ColorChannel, stepSize: number): ColorType;
19
- decrementChannel(channel: ColorChannel, stepSize: number): ColorType;
20
- isEqual(color: ColorType): boolean;
21
- }
22
-
23
- export { Color };
1
+ import { Color2DAxes, ColorAxes, ColorChannel, ColorChannelRange, ColorFormat, ColorStringFormat, ColorType } from "./types.js";
2
+ export declare abstract class Color implements ColorType {
3
+ abstract toFormat(format: ColorFormat): ColorType;
4
+ abstract toJSON(): Record<string, number>;
5
+ abstract toString(format?: ColorStringFormat): string;
6
+ abstract clone(): ColorType;
7
+ abstract getChannelRange(channel: ColorChannel): ColorChannelRange;
8
+ abstract getFormat(): ColorFormat;
9
+ abstract getChannels(): [ColorChannel, ColorChannel, ColorChannel];
10
+ abstract formatChannelValue(channel: ColorChannel, locale: string): string;
11
+ toHexInt(): number;
12
+ getChannelValue(channel: ColorChannel): number;
13
+ getChannelValuePercent(channel: ColorChannel, valueToCheck?: number): number;
14
+ getChannelPercentValue(channel: ColorChannel, percentToCheck: number): number;
15
+ withChannelValue(channel: ColorChannel, value: number): ColorType;
16
+ getColorAxes(xyChannels: Color2DAxes): ColorAxes;
17
+ incrementChannel(channel: ColorChannel, stepSize: number): ColorType;
18
+ decrementChannel(channel: ColorChannel, stepSize: number): ColorType;
19
+ isEqual(color: ColorType): boolean;
20
+ }
package/dist/color.js CHANGED
@@ -1,87 +1,61 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/color.ts
21
- var color_exports = {};
22
- __export(color_exports, {
23
- Color: () => Color
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
24
4
  });
25
- module.exports = __toCommonJS(color_exports);
26
- var import_utils = require("@zag-js/utils");
27
- var isEqualObject = (a, b) => {
28
- if (Object.keys(a).length !== Object.keys(b).length) return false;
29
- for (let key in a) if (a[key] !== b[key]) return false;
30
- return true;
5
+ let _zag_js_utils = require("@zag-js/utils");
6
+ // src/color.ts
7
+ const isEqualObject = (a, b) => {
8
+ if (Object.keys(a).length !== Object.keys(b).length) return false;
9
+ for (let key in a) if (a[key] !== b[key]) return false;
10
+ return true;
31
11
  };
32
12
  var Color = class {
33
- toHexInt() {
34
- return this.toFormat("rgba").toHexInt();
35
- }
36
- getChannelValue(channel) {
37
- if (channel in this) return this[channel];
38
- throw new Error("Unsupported color channel: " + channel);
39
- }
40
- getChannelValuePercent(channel, valueToCheck) {
41
- const value = valueToCheck ?? this.getChannelValue(channel);
42
- const { minValue, maxValue } = this.getChannelRange(channel);
43
- return (0, import_utils.getValuePercent)(value, minValue, maxValue);
44
- }
45
- getChannelPercentValue(channel, percentToCheck) {
46
- const { minValue, maxValue, step } = this.getChannelRange(channel);
47
- const percentValue = (0, import_utils.getPercentValue)(percentToCheck, minValue, maxValue, step);
48
- return (0, import_utils.snapValueToStep)(percentValue, minValue, maxValue, step);
49
- }
50
- withChannelValue(channel, value) {
51
- const { minValue, maxValue } = this.getChannelRange(channel);
52
- if (channel in this) {
53
- let clone = this.clone();
54
- clone[channel] = (0, import_utils.clampValue)(value, minValue, maxValue);
55
- return clone;
56
- }
57
- throw new Error("Unsupported color channel: " + channel);
58
- }
59
- getColorAxes(xyChannels) {
60
- let { xChannel, yChannel } = xyChannels;
61
- let xCh = xChannel || this.getChannels().find((c) => c !== yChannel);
62
- let yCh = yChannel || this.getChannels().find((c) => c !== xCh);
63
- let zCh = this.getChannels().find((c) => c !== xCh && c !== yCh);
64
- return { xChannel: xCh, yChannel: yCh, zChannel: zCh };
65
- }
66
- incrementChannel(channel, stepSize) {
67
- const { minValue, maxValue, step } = this.getChannelRange(channel);
68
- const value = (0, import_utils.snapValueToStep)(
69
- (0, import_utils.clampValue)(this.getChannelValue(channel) + stepSize, minValue, maxValue),
70
- minValue,
71
- maxValue,
72
- step
73
- );
74
- return this.withChannelValue(channel, value);
75
- }
76
- decrementChannel(channel, stepSize) {
77
- return this.incrementChannel(channel, -stepSize);
78
- }
79
- isEqual(color) {
80
- const isSame = isEqualObject(this.toJSON(), color.toJSON());
81
- return isSame && this.getChannelValue("alpha") === color.getChannelValue("alpha");
82
- }
13
+ toHexInt() {
14
+ return this.toFormat("rgba").toHexInt();
15
+ }
16
+ getChannelValue(channel) {
17
+ if (channel in this) return this[channel];
18
+ throw new Error("Unsupported color channel: " + channel);
19
+ }
20
+ getChannelValuePercent(channel, valueToCheck) {
21
+ const value = valueToCheck ?? this.getChannelValue(channel);
22
+ const { minValue, maxValue } = this.getChannelRange(channel);
23
+ return (0, _zag_js_utils.getValuePercent)(value, minValue, maxValue);
24
+ }
25
+ getChannelPercentValue(channel, percentToCheck) {
26
+ const { minValue, maxValue, step } = this.getChannelRange(channel);
27
+ const percentValue = (0, _zag_js_utils.getPercentValue)(percentToCheck, minValue, maxValue, step);
28
+ return (0, _zag_js_utils.snapValueToStep)(percentValue, minValue, maxValue, step);
29
+ }
30
+ withChannelValue(channel, value) {
31
+ const { minValue, maxValue } = this.getChannelRange(channel);
32
+ if (channel in this) {
33
+ let clone = this.clone();
34
+ clone[channel] = (0, _zag_js_utils.clampValue)(value, minValue, maxValue);
35
+ return clone;
36
+ }
37
+ throw new Error("Unsupported color channel: " + channel);
38
+ }
39
+ getColorAxes(xyChannels) {
40
+ let { xChannel, yChannel } = xyChannels;
41
+ let xCh = xChannel || this.getChannels().find((c) => c !== yChannel);
42
+ let yCh = yChannel || this.getChannels().find((c) => c !== xCh);
43
+ return {
44
+ xChannel: xCh,
45
+ yChannel: yCh,
46
+ zChannel: this.getChannels().find((c) => c !== xCh && c !== yCh)
47
+ };
48
+ }
49
+ incrementChannel(channel, stepSize) {
50
+ const { minValue, maxValue, step } = this.getChannelRange(channel);
51
+ const value = (0, _zag_js_utils.snapValueToStep)((0, _zag_js_utils.clampValue)(this.getChannelValue(channel) + stepSize, minValue, maxValue), minValue, maxValue, step);
52
+ return this.withChannelValue(channel, value);
53
+ }
54
+ decrementChannel(channel, stepSize) {
55
+ return this.incrementChannel(channel, -stepSize);
56
+ }
57
+ isEqual(color) {
58
+ return isEqualObject(this.toJSON(), color.toJSON()) && this.getChannelValue("alpha") === color.getChannelValue("alpha");
59
+ }
83
60
  };
84
- // Annotate the CommonJS export names for ESM import in node:
85
- 0 && (module.exports = {
86
- Color
87
- });
61
+ exports.Color = Color;
package/dist/color.mjs CHANGED
@@ -1,64 +1,57 @@
1
- import "./chunk-QZ7TP4HQ.mjs";
2
-
3
- // src/color.ts
4
1
  import { clampValue, getPercentValue, getValuePercent, snapValueToStep } from "@zag-js/utils";
5
- var isEqualObject = (a, b) => {
6
- if (Object.keys(a).length !== Object.keys(b).length) return false;
7
- for (let key in a) if (a[key] !== b[key]) return false;
8
- return true;
2
+ // src/color.ts
3
+ const isEqualObject = (a, b) => {
4
+ if (Object.keys(a).length !== Object.keys(b).length) return false;
5
+ for (let key in a) if (a[key] !== b[key]) return false;
6
+ return true;
9
7
  };
10
8
  var Color = class {
11
- toHexInt() {
12
- return this.toFormat("rgba").toHexInt();
13
- }
14
- getChannelValue(channel) {
15
- if (channel in this) return this[channel];
16
- throw new Error("Unsupported color channel: " + channel);
17
- }
18
- getChannelValuePercent(channel, valueToCheck) {
19
- const value = valueToCheck ?? this.getChannelValue(channel);
20
- const { minValue, maxValue } = this.getChannelRange(channel);
21
- return getValuePercent(value, minValue, maxValue);
22
- }
23
- getChannelPercentValue(channel, percentToCheck) {
24
- const { minValue, maxValue, step } = this.getChannelRange(channel);
25
- const percentValue = getPercentValue(percentToCheck, minValue, maxValue, step);
26
- return snapValueToStep(percentValue, minValue, maxValue, step);
27
- }
28
- withChannelValue(channel, value) {
29
- const { minValue, maxValue } = this.getChannelRange(channel);
30
- if (channel in this) {
31
- let clone = this.clone();
32
- clone[channel] = clampValue(value, minValue, maxValue);
33
- return clone;
34
- }
35
- throw new Error("Unsupported color channel: " + channel);
36
- }
37
- getColorAxes(xyChannels) {
38
- let { xChannel, yChannel } = xyChannels;
39
- let xCh = xChannel || this.getChannels().find((c) => c !== yChannel);
40
- let yCh = yChannel || this.getChannels().find((c) => c !== xCh);
41
- let zCh = this.getChannels().find((c) => c !== xCh && c !== yCh);
42
- return { xChannel: xCh, yChannel: yCh, zChannel: zCh };
43
- }
44
- incrementChannel(channel, stepSize) {
45
- const { minValue, maxValue, step } = this.getChannelRange(channel);
46
- const value = snapValueToStep(
47
- clampValue(this.getChannelValue(channel) + stepSize, minValue, maxValue),
48
- minValue,
49
- maxValue,
50
- step
51
- );
52
- return this.withChannelValue(channel, value);
53
- }
54
- decrementChannel(channel, stepSize) {
55
- return this.incrementChannel(channel, -stepSize);
56
- }
57
- isEqual(color) {
58
- const isSame = isEqualObject(this.toJSON(), color.toJSON());
59
- return isSame && this.getChannelValue("alpha") === color.getChannelValue("alpha");
60
- }
61
- };
62
- export {
63
- Color
9
+ toHexInt() {
10
+ return this.toFormat("rgba").toHexInt();
11
+ }
12
+ getChannelValue(channel) {
13
+ if (channel in this) return this[channel];
14
+ throw new Error("Unsupported color channel: " + channel);
15
+ }
16
+ getChannelValuePercent(channel, valueToCheck) {
17
+ const value = valueToCheck ?? this.getChannelValue(channel);
18
+ const { minValue, maxValue } = this.getChannelRange(channel);
19
+ return getValuePercent(value, minValue, maxValue);
20
+ }
21
+ getChannelPercentValue(channel, percentToCheck) {
22
+ const { minValue, maxValue, step } = this.getChannelRange(channel);
23
+ const percentValue = getPercentValue(percentToCheck, minValue, maxValue, step);
24
+ return snapValueToStep(percentValue, minValue, maxValue, step);
25
+ }
26
+ withChannelValue(channel, value) {
27
+ const { minValue, maxValue } = this.getChannelRange(channel);
28
+ if (channel in this) {
29
+ let clone = this.clone();
30
+ clone[channel] = clampValue(value, minValue, maxValue);
31
+ return clone;
32
+ }
33
+ throw new Error("Unsupported color channel: " + channel);
34
+ }
35
+ getColorAxes(xyChannels) {
36
+ let { xChannel, yChannel } = xyChannels;
37
+ let xCh = xChannel || this.getChannels().find((c) => c !== yChannel);
38
+ let yCh = yChannel || this.getChannels().find((c) => c !== xCh);
39
+ return {
40
+ xChannel: xCh,
41
+ yChannel: yCh,
42
+ zChannel: this.getChannels().find((c) => c !== xCh && c !== yCh)
43
+ };
44
+ }
45
+ incrementChannel(channel, stepSize) {
46
+ const { minValue, maxValue, step } = this.getChannelRange(channel);
47
+ const value = snapValueToStep(clampValue(this.getChannelValue(channel) + stepSize, minValue, maxValue), minValue, maxValue, step);
48
+ return this.withChannelValue(channel, value);
49
+ }
50
+ decrementChannel(channel, stepSize) {
51
+ return this.incrementChannel(channel, -stepSize);
52
+ }
53
+ isEqual(color) {
54
+ return isEqualObject(this.toJSON(), color.toJSON()) && this.getChannelValue("alpha") === color.getChannelValue("alpha");
55
+ }
64
56
  };
57
+ export { Color };
@@ -1,35 +1,32 @@
1
- import { Color } from './color.mjs';
2
- import { ColorStringFormat, ColorFormat, ColorType, ColorChannel, ColorChannelRange } from './types.mjs';
3
-
4
- declare class HSBColor extends Color {
5
- private hue;
6
- private saturation;
7
- private brightness;
8
- private alpha;
9
- constructor(hue: number, saturation: number, brightness: number, alpha: number);
10
- static parse(value: string): HSBColor | void;
11
- toString(format?: ColorStringFormat): string;
12
- toFormat(format: ColorFormat): ColorType;
13
- /**
14
- * Converts a HSB color to HSL.
15
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.
16
- * @returns An HSLColor object.
17
- */
18
- private toHSL;
19
- /**
20
- * Converts a HSV color value to RGB.
21
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.
22
- * @returns An RGBColor object.
23
- */
24
- private toRGB;
25
- clone(): ColorType;
26
- getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
27
- formatChannelValue(channel: ColorChannel, locale: string): string;
28
- getChannelRange(channel: ColorChannel): ColorChannelRange;
29
- toJSON(): Record<"h" | "s" | "b" | "a", number>;
30
- getFormat(): ColorFormat;
31
- private static colorChannels;
32
- getChannels(): [ColorChannel, ColorChannel, ColorChannel];
33
- }
34
-
35
- export { HSBColor };
1
+ import { Color } from "./color.mjs";
2
+ import { ColorChannel, ColorChannelRange, ColorFormat, ColorStringFormat, ColorType } from "./types.mjs";
3
+ export declare class HSBColor extends Color {
4
+ private hue;
5
+ private saturation;
6
+ private brightness;
7
+ private alpha;
8
+ constructor(hue: number, saturation: number, brightness: number, alpha: number);
9
+ static parse(value: string): HSBColor | void;
10
+ toString(format?: ColorStringFormat): string;
11
+ toFormat(format: ColorFormat): ColorType;
12
+ /**
13
+ * Converts a HSB color to HSL.
14
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.
15
+ * @returns An HSLColor object.
16
+ */
17
+ private toHSL;
18
+ /**
19
+ * Converts a HSV color value to RGB.
20
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.
21
+ * @returns An RGBColor object.
22
+ */
23
+ private toRGB;
24
+ clone(): ColorType;
25
+ getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
26
+ formatChannelValue(channel: ColorChannel, locale: string): string;
27
+ getChannelRange(channel: ColorChannel): ColorChannelRange;
28
+ toJSON(): Record<"h" | "s" | "b" | "a", number>;
29
+ getFormat(): ColorFormat;
30
+ private static colorChannels;
31
+ getChannels(): [ColorChannel, ColorChannel, ColorChannel];
32
+ }
@@ -1,35 +1,32 @@
1
- import { Color } from './color.js';
2
- import { ColorStringFormat, ColorFormat, ColorType, ColorChannel, ColorChannelRange } from './types.js';
3
-
4
- declare class HSBColor extends Color {
5
- private hue;
6
- private saturation;
7
- private brightness;
8
- private alpha;
9
- constructor(hue: number, saturation: number, brightness: number, alpha: number);
10
- static parse(value: string): HSBColor | void;
11
- toString(format?: ColorStringFormat): string;
12
- toFormat(format: ColorFormat): ColorType;
13
- /**
14
- * Converts a HSB color to HSL.
15
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.
16
- * @returns An HSLColor object.
17
- */
18
- private toHSL;
19
- /**
20
- * Converts a HSV color value to RGB.
21
- * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.
22
- * @returns An RGBColor object.
23
- */
24
- private toRGB;
25
- clone(): ColorType;
26
- getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
27
- formatChannelValue(channel: ColorChannel, locale: string): string;
28
- getChannelRange(channel: ColorChannel): ColorChannelRange;
29
- toJSON(): Record<"h" | "s" | "b" | "a", number>;
30
- getFormat(): ColorFormat;
31
- private static colorChannels;
32
- getChannels(): [ColorChannel, ColorChannel, ColorChannel];
33
- }
34
-
35
- export { HSBColor };
1
+ import { Color } from "./color.js";
2
+ import { ColorChannel, ColorChannelRange, ColorFormat, ColorStringFormat, ColorType } from "./types.js";
3
+ export declare class HSBColor extends Color {
4
+ private hue;
5
+ private saturation;
6
+ private brightness;
7
+ private alpha;
8
+ constructor(hue: number, saturation: number, brightness: number, alpha: number);
9
+ static parse(value: string): HSBColor | void;
10
+ toString(format?: ColorStringFormat): string;
11
+ toFormat(format: ColorFormat): ColorType;
12
+ /**
13
+ * Converts a HSB color to HSL.
14
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.
15
+ * @returns An HSLColor object.
16
+ */
17
+ private toHSL;
18
+ /**
19
+ * Converts a HSV color value to RGB.
20
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.
21
+ * @returns An RGBColor object.
22
+ */
23
+ private toRGB;
24
+ clone(): ColorType;
25
+ getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;
26
+ formatChannelValue(channel: ColorChannel, locale: string): string;
27
+ getChannelRange(channel: ColorChannel): ColorChannelRange;
28
+ toJSON(): Record<"h" | "s" | "b" | "a", number>;
29
+ getFormat(): ColorFormat;
30
+ private static colorChannels;
31
+ getChannels(): [ColorChannel, ColorChannel, ColorChannel];
32
+ }