@zag-js/color-utils 1.47.0 → 1.49.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/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.js +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.mjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/toPrimitive.js +13 -0
- package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/toPrimitive.mjs +13 -0
- package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/toPropertyKey.js +8 -0
- package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/toPropertyKey.mjs +8 -0
- package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/typeof.js +15 -0
- package/dist/_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/typeof.mjs +10 -0
- package/dist/area-gradient.d.mts +9 -11
- package/dist/area-gradient.d.ts +9 -11
- package/dist/area-gradient.js +53 -84
- package/dist/area-gradient.mjs +49 -71
- package/dist/color-format-gradient.d.mts +58 -60
- package/dist/color-format-gradient.d.ts +58 -60
- package/dist/color-format-gradient.js +93 -154
- package/dist/color-format-gradient.mjs +81 -123
- package/dist/color.d.mts +20 -23
- package/dist/color.d.ts +20 -23
- package/dist/color.js +57 -83
- package/dist/color.mjs +53 -60
- package/dist/hsb-color.d.mts +32 -35
- package/dist/hsb-color.d.ts +32 -35
- package/dist/hsb-color.js +133 -163
- package/dist/hsb-color.mjs +127 -138
- package/dist/hsl-color.d.mts +32 -36
- package/dist/hsl-color.d.ts +32 -36
- package/dist/hsl-color.js +134 -165
- package/dist/hsl-color.mjs +128 -139
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +10 -37
- package/dist/index.mjs +1 -9
- package/dist/native-color.d.mts +1 -3
- package/dist/native-color.d.ts +1 -3
- package/dist/native-color.js +16 -39
- package/dist/native-color.mjs +12 -16
- package/dist/parse-color.d.mts +3 -6
- package/dist/parse-color.d.ts +3 -6
- package/dist/parse-color.js +21 -47
- package/dist/parse-color.mjs +13 -20
- package/dist/parse-utils.d.mts +12 -0
- package/dist/parse-utils.d.ts +12 -0
- package/dist/parse-utils.js +62 -0
- package/dist/parse-utils.mjs +56 -0
- package/dist/rgb-color.d.mts +33 -36
- package/dist/rgb-color.d.ts +33 -36
- package/dist/rgb-color.js +181 -211
- package/dist/rgb-color.mjs +174 -185
- package/dist/types.d.mts +82 -84
- package/dist/types.d.ts +82 -84
- package/dist/types.js +4 -18
- package/dist/types.mjs +1 -0
- package/package.json +4 -4
- package/dist/chunk-QZ7TP4HQ.mjs +0 -7
package/dist/color.d.mts
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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 };
|
package/dist/hsb-color.d.mts
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
import { Color } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
+
}
|
package/dist/hsb-color.d.ts
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
import { Color } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
+
}
|