@phun-ky/moebius 0.2.4 → 1.0.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/README.md +6 -1
- package/{moebius.d.ts → dist/moebius.d.ts} +532 -532
- package/dist/moebius.js +84 -0
- package/dist/moebius.js.map +1 -0
- package/package.json +58 -35
- package/moebius.js +0 -2
- package/moebius.js.map +0 -1
|
@@ -1,542 +1,542 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a color object with various color representations.
|
|
3
|
-
*/
|
|
4
|
-
interface MoebiusColorInterface {
|
|
5
|
-
color: MoebiusChromaColorInputType;
|
|
6
|
-
name: string;
|
|
7
|
-
hex: MoebiusColorValueHexType;
|
|
8
|
-
rgb: MoebiusColorValueRgbType;
|
|
9
|
-
hsl: MoebiusHSLObjectType;
|
|
10
|
-
hslFloat: MoebiusHSLObjectType;
|
|
11
|
-
rgbFloat: MoebiusRGBObjectType;
|
|
12
|
-
hwb: MoebiusHWBObjectType;
|
|
13
|
-
hsv: MoebiusHSVObjectType;
|
|
14
|
-
lab: MoebiusLABObjectType;
|
|
15
|
-
xyz: MoebiusXYZObjectType;
|
|
16
|
-
lch: MoebiusLCHObjectType;
|
|
17
|
-
oklch: MoebiusLCHObjectType;
|
|
18
|
-
hsi: MoebiusHSIObjectType;
|
|
19
|
-
oklab: MoebiusLABObjectType;
|
|
20
|
-
cmyk: MoebiusCMYKObjectType;
|
|
21
|
-
}
|
|
22
|
-
interface MoebiusPaletteInterface {
|
|
23
|
-
baseColor: MoebiusColorInterface;
|
|
24
|
-
secondaryColor: MoebiusColorInterface;
|
|
25
|
-
colors: Record<string, unknown> | MoebiusPaletteColorsInterface;
|
|
26
|
-
themes: Record<string, unknown> | MoebiusThemeColorsInterface;
|
|
27
|
-
defaultOptions: MoebiusPaletteDefaultOptionsType;
|
|
28
|
-
options: MoebiusPaletteOptionsType;
|
|
29
|
-
all: MoebiusColorValueHexType[];
|
|
30
|
-
accents: MoebiusPaletteAccentColorsInterface;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Represents a palette of colors with different schemes.
|
|
34
|
-
*/
|
|
35
|
-
interface MoebiusPaletteColorsInterface {
|
|
36
|
-
interpolate: MoebiusColorValueHexType[];
|
|
37
|
-
luminanceShift: MoebiusColorValueHexType[];
|
|
38
|
-
monochromatic: MoebiusColorValueHexType[];
|
|
39
|
-
complement: MoebiusColorValueHexType[];
|
|
40
|
-
split: MoebiusColorValueHexType[];
|
|
41
|
-
triadic: MoebiusColorValueHexType[];
|
|
42
|
-
tetradic: MoebiusColorValueHexType[];
|
|
43
|
-
pentadic: MoebiusColorValueHexType[];
|
|
44
|
-
hexadic: MoebiusColorValueHexType[];
|
|
45
|
-
analogous: MoebiusColorValueHexType[];
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Represents a palette of colors with different themes.
|
|
49
|
-
*/
|
|
50
|
-
interface MoebiusThemeColorsInterface {
|
|
51
|
-
darkmode: Record<string, MoebiusColorValueHexType[]>;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Represents a palette of accent colors with different schemes.
|
|
55
|
-
*/
|
|
56
|
-
interface MoebiusPaletteAccentColorsInterface {
|
|
57
|
-
interpolate: MoebiusColorValueHexType[][];
|
|
58
|
-
luminanceShift: MoebiusColorValueHexType[][];
|
|
59
|
-
monochromatic: MoebiusColorValueHexType[][];
|
|
60
|
-
complement: MoebiusColorValueHexType[][];
|
|
61
|
-
split: MoebiusColorValueHexType[][];
|
|
62
|
-
triadic: MoebiusColorValueHexType[][];
|
|
63
|
-
tetradic: MoebiusColorValueHexType[][];
|
|
64
|
-
pentadic: MoebiusColorValueHexType[][];
|
|
65
|
-
hexadic: MoebiusColorValueHexType[][];
|
|
66
|
-
analogous: MoebiusColorValueHexType[][];
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Represents options for generating a color palette.
|
|
70
|
-
*/
|
|
71
|
-
type MoebiusPaletteOptionsType = {
|
|
72
|
-
baseColor: MoebiusColorInterface;
|
|
73
|
-
secondaryColor: MoebiusColorInterface;
|
|
74
|
-
divergentColor?: MoebiusColorValueHexType;
|
|
75
|
-
diverging?: boolean;
|
|
76
|
-
bezier?: boolean;
|
|
77
|
-
randomOffset?: boolean;
|
|
78
|
-
correctLightness?: boolean;
|
|
79
|
-
noDuplicates?: boolean;
|
|
80
|
-
colorScaleMode?: string;
|
|
81
|
-
divergingColor?: string;
|
|
82
|
-
reverseDirection?: boolean;
|
|
83
|
-
numberOfColors?: number;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Represents default options for generating a color palette.
|
|
87
|
-
*/
|
|
88
|
-
type MoebiusPaletteDefaultOptionsType = {
|
|
89
|
-
divergentColor?: MoebiusColorValueHexType;
|
|
90
|
-
diverging: boolean;
|
|
91
|
-
bezier: boolean;
|
|
92
|
-
randomOffset: boolean;
|
|
93
|
-
correctLightness: boolean;
|
|
94
|
-
noDuplicates: boolean;
|
|
95
|
-
colorScaleMode: string;
|
|
96
|
-
reverseDirection: boolean;
|
|
97
|
-
numberOfColors?: number;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Represents a color value in hexadecimal format.
|
|
101
|
-
*/
|
|
102
|
-
type MoebiusColorValueHexType = `#${string}`;
|
|
103
|
-
/**
|
|
104
|
-
* Represents a color value in HSL format.
|
|
105
|
-
*/
|
|
106
|
-
type MoebiusColorValueHslType = `hsl(${number}, ${string}, ${string})`;
|
|
107
|
-
/**
|
|
108
|
-
* Represents a color value in HSLA format.
|
|
109
|
-
*/
|
|
110
|
-
type MoebiusColorValueHslaType = `hsl(${number}, ${string}, ${string}, ${number})`;
|
|
111
|
-
/**
|
|
112
|
-
* Represents a color value in RGB format.
|
|
113
|
-
*/
|
|
114
|
-
type MoebiusColorValueRgbType = `rgb(${number}, ${number}, ${number})`;
|
|
115
|
-
/**
|
|
116
|
-
* Represents a color value in RGBA format.
|
|
117
|
-
*/
|
|
118
|
-
type MoebiusColorValueRgbaType = `rgb(${number}, ${number}, ${number}, ${number})`;
|
|
119
|
-
/**
|
|
120
|
-
* Represents an RGB color object.
|
|
121
|
-
*/
|
|
122
|
-
type MoebiusRGBObjectType = {
|
|
123
|
-
r: number;
|
|
124
|
-
g: number;
|
|
125
|
-
b: number;
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Represents an HSL color object.
|
|
129
|
-
*/
|
|
130
|
-
type MoebiusHSLObjectType = {
|
|
131
|
-
h: number;
|
|
132
|
-
s: number;
|
|
133
|
-
l: number;
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Represents an HSV color object.
|
|
137
|
-
*/
|
|
138
|
-
type MoebiusHSVObjectType = {
|
|
139
|
-
h: number;
|
|
140
|
-
s: number;
|
|
141
|
-
v: number;
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* Represents an LCH color object.
|
|
145
|
-
*/
|
|
146
|
-
type MoebiusLCHObjectType = {
|
|
147
|
-
l: number;
|
|
148
|
-
c: number;
|
|
149
|
-
h: number;
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Represents an HSI color object.
|
|
153
|
-
*/
|
|
154
|
-
type MoebiusHSIObjectType = {
|
|
155
|
-
h: number;
|
|
156
|
-
s: number;
|
|
157
|
-
i: number;
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Represents an XYZ color object.
|
|
161
|
-
*/
|
|
162
|
-
type MoebiusXYZObjectType = {
|
|
163
|
-
x: number;
|
|
164
|
-
y: number;
|
|
165
|
-
z: number;
|
|
166
|
-
};
|
|
167
|
-
/**
|
|
168
|
-
* Represents an HWB color object.
|
|
169
|
-
*/
|
|
170
|
-
type MoebiusHWBObjectType = {
|
|
171
|
-
h: number;
|
|
172
|
-
w: number;
|
|
173
|
-
b: number;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Represents a LAB color object.
|
|
177
|
-
*/
|
|
178
|
-
type MoebiusLABObjectType = {
|
|
179
|
-
l: number;
|
|
180
|
-
a: number;
|
|
181
|
-
b: number;
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
184
|
-
* Represents a CMYK color object.
|
|
185
|
-
*/
|
|
186
|
-
type MoebiusCMYKObjectType = {
|
|
187
|
-
c: number;
|
|
188
|
-
m: number;
|
|
189
|
-
y: number;
|
|
190
|
-
k: number;
|
|
191
|
-
};
|
|
192
|
-
/**
|
|
193
|
-
* Represents a color specification for nearest color matching.
|
|
194
|
-
*/
|
|
195
|
-
interface NearestColorColorSpecInterface {
|
|
196
|
-
name: string;
|
|
197
|
-
source: string;
|
|
198
|
-
rgb: MoebiusRGBObjectType;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Represents a color match for nearest color matching.
|
|
202
|
-
*/
|
|
203
|
-
interface NearestColorColorMatchInterface {
|
|
204
|
-
name: string;
|
|
205
|
-
value: string;
|
|
206
|
-
rgb: MoebiusRGBObjectType;
|
|
207
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Represents a color object with various color representations.
|
|
3
|
+
*/
|
|
4
|
+
interface MoebiusColorInterface {
|
|
5
|
+
color: MoebiusChromaColorInputType;
|
|
6
|
+
name: string;
|
|
7
|
+
hex: MoebiusColorValueHexType;
|
|
8
|
+
rgb: MoebiusColorValueRgbType;
|
|
9
|
+
hsl: MoebiusHSLObjectType;
|
|
10
|
+
hslFloat: MoebiusHSLObjectType;
|
|
11
|
+
rgbFloat: MoebiusRGBObjectType;
|
|
12
|
+
hwb: MoebiusHWBObjectType;
|
|
13
|
+
hsv: MoebiusHSVObjectType;
|
|
14
|
+
lab: MoebiusLABObjectType;
|
|
15
|
+
xyz: MoebiusXYZObjectType;
|
|
16
|
+
lch: MoebiusLCHObjectType;
|
|
17
|
+
oklch: MoebiusLCHObjectType;
|
|
18
|
+
hsi: MoebiusHSIObjectType;
|
|
19
|
+
oklab: MoebiusLABObjectType;
|
|
20
|
+
cmyk: MoebiusCMYKObjectType;
|
|
21
|
+
}
|
|
22
|
+
interface MoebiusPaletteInterface {
|
|
23
|
+
baseColor: MoebiusColorInterface;
|
|
24
|
+
secondaryColor: MoebiusColorInterface;
|
|
25
|
+
colors: Record<string, unknown> | MoebiusPaletteColorsInterface;
|
|
26
|
+
themes: Record<string, unknown> | MoebiusThemeColorsInterface;
|
|
27
|
+
defaultOptions: MoebiusPaletteDefaultOptionsType;
|
|
28
|
+
options: MoebiusPaletteOptionsType;
|
|
29
|
+
all: MoebiusColorValueHexType[];
|
|
30
|
+
accents: MoebiusPaletteAccentColorsInterface;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Represents a palette of colors with different schemes.
|
|
34
|
+
*/
|
|
35
|
+
interface MoebiusPaletteColorsInterface {
|
|
36
|
+
interpolate: MoebiusColorValueHexType[];
|
|
37
|
+
luminanceShift: MoebiusColorValueHexType[];
|
|
38
|
+
monochromatic: MoebiusColorValueHexType[];
|
|
39
|
+
complement: MoebiusColorValueHexType[];
|
|
40
|
+
split: MoebiusColorValueHexType[];
|
|
41
|
+
triadic: MoebiusColorValueHexType[];
|
|
42
|
+
tetradic: MoebiusColorValueHexType[];
|
|
43
|
+
pentadic: MoebiusColorValueHexType[];
|
|
44
|
+
hexadic: MoebiusColorValueHexType[];
|
|
45
|
+
analogous: MoebiusColorValueHexType[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Represents a palette of colors with different themes.
|
|
49
|
+
*/
|
|
50
|
+
interface MoebiusThemeColorsInterface {
|
|
51
|
+
darkmode: Record<string, MoebiusColorValueHexType[]>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Represents a palette of accent colors with different schemes.
|
|
55
|
+
*/
|
|
56
|
+
interface MoebiusPaletteAccentColorsInterface {
|
|
57
|
+
interpolate: MoebiusColorValueHexType[][];
|
|
58
|
+
luminanceShift: MoebiusColorValueHexType[][];
|
|
59
|
+
monochromatic: MoebiusColorValueHexType[][];
|
|
60
|
+
complement: MoebiusColorValueHexType[][];
|
|
61
|
+
split: MoebiusColorValueHexType[][];
|
|
62
|
+
triadic: MoebiusColorValueHexType[][];
|
|
63
|
+
tetradic: MoebiusColorValueHexType[][];
|
|
64
|
+
pentadic: MoebiusColorValueHexType[][];
|
|
65
|
+
hexadic: MoebiusColorValueHexType[][];
|
|
66
|
+
analogous: MoebiusColorValueHexType[][];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Represents options for generating a color palette.
|
|
70
|
+
*/
|
|
71
|
+
type MoebiusPaletteOptionsType = {
|
|
72
|
+
baseColor: MoebiusColorInterface;
|
|
73
|
+
secondaryColor: MoebiusColorInterface;
|
|
74
|
+
divergentColor?: MoebiusColorValueHexType;
|
|
75
|
+
diverging?: boolean;
|
|
76
|
+
bezier?: boolean;
|
|
77
|
+
randomOffset?: boolean;
|
|
78
|
+
correctLightness?: boolean;
|
|
79
|
+
noDuplicates?: boolean;
|
|
80
|
+
colorScaleMode?: string;
|
|
81
|
+
divergingColor?: string;
|
|
82
|
+
reverseDirection?: boolean;
|
|
83
|
+
numberOfColors?: number;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Represents default options for generating a color palette.
|
|
87
|
+
*/
|
|
88
|
+
type MoebiusPaletteDefaultOptionsType = {
|
|
89
|
+
divergentColor?: MoebiusColorValueHexType;
|
|
90
|
+
diverging: boolean;
|
|
91
|
+
bezier: boolean;
|
|
92
|
+
randomOffset: boolean;
|
|
93
|
+
correctLightness: boolean;
|
|
94
|
+
noDuplicates: boolean;
|
|
95
|
+
colorScaleMode: string;
|
|
96
|
+
reverseDirection: boolean;
|
|
97
|
+
numberOfColors?: number;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Represents a color value in hexadecimal format.
|
|
101
|
+
*/
|
|
102
|
+
type MoebiusColorValueHexType = `#${string}`;
|
|
103
|
+
/**
|
|
104
|
+
* Represents a color value in HSL format.
|
|
105
|
+
*/
|
|
106
|
+
type MoebiusColorValueHslType = `hsl(${number}, ${string}, ${string})`;
|
|
107
|
+
/**
|
|
108
|
+
* Represents a color value in HSLA format.
|
|
109
|
+
*/
|
|
110
|
+
type MoebiusColorValueHslaType = `hsl(${number}, ${string}, ${string}, ${number})`;
|
|
111
|
+
/**
|
|
112
|
+
* Represents a color value in RGB format.
|
|
113
|
+
*/
|
|
114
|
+
type MoebiusColorValueRgbType = `rgb(${number}, ${number}, ${number})`;
|
|
115
|
+
/**
|
|
116
|
+
* Represents a color value in RGBA format.
|
|
117
|
+
*/
|
|
118
|
+
type MoebiusColorValueRgbaType = `rgb(${number}, ${number}, ${number}, ${number})`;
|
|
119
|
+
/**
|
|
120
|
+
* Represents an RGB color object.
|
|
121
|
+
*/
|
|
122
|
+
type MoebiusRGBObjectType = {
|
|
123
|
+
r: number;
|
|
124
|
+
g: number;
|
|
125
|
+
b: number;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Represents an HSL color object.
|
|
129
|
+
*/
|
|
130
|
+
type MoebiusHSLObjectType = {
|
|
131
|
+
h: number;
|
|
132
|
+
s: number;
|
|
133
|
+
l: number;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Represents an HSV color object.
|
|
137
|
+
*/
|
|
138
|
+
type MoebiusHSVObjectType = {
|
|
139
|
+
h: number;
|
|
140
|
+
s: number;
|
|
141
|
+
v: number;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Represents an LCH color object.
|
|
145
|
+
*/
|
|
146
|
+
type MoebiusLCHObjectType = {
|
|
147
|
+
l: number;
|
|
148
|
+
c: number;
|
|
149
|
+
h: number;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Represents an HSI color object.
|
|
153
|
+
*/
|
|
154
|
+
type MoebiusHSIObjectType = {
|
|
155
|
+
h: number;
|
|
156
|
+
s: number;
|
|
157
|
+
i: number;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Represents an XYZ color object.
|
|
161
|
+
*/
|
|
162
|
+
type MoebiusXYZObjectType = {
|
|
163
|
+
x: number;
|
|
164
|
+
y: number;
|
|
165
|
+
z: number;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Represents an HWB color object.
|
|
169
|
+
*/
|
|
170
|
+
type MoebiusHWBObjectType = {
|
|
171
|
+
h: number;
|
|
172
|
+
w: number;
|
|
173
|
+
b: number;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Represents a LAB color object.
|
|
177
|
+
*/
|
|
178
|
+
type MoebiusLABObjectType = {
|
|
179
|
+
l: number;
|
|
180
|
+
a: number;
|
|
181
|
+
b: number;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Represents a CMYK color object.
|
|
185
|
+
*/
|
|
186
|
+
type MoebiusCMYKObjectType = {
|
|
187
|
+
c: number;
|
|
188
|
+
m: number;
|
|
189
|
+
y: number;
|
|
190
|
+
k: number;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Represents a color specification for nearest color matching.
|
|
194
|
+
*/
|
|
195
|
+
interface NearestColorColorSpecInterface {
|
|
196
|
+
name: string;
|
|
197
|
+
source: string;
|
|
198
|
+
rgb: MoebiusRGBObjectType;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Represents a color match for nearest color matching.
|
|
202
|
+
*/
|
|
203
|
+
interface NearestColorColorMatchInterface {
|
|
204
|
+
name: string;
|
|
205
|
+
value: string;
|
|
206
|
+
rgb: MoebiusRGBObjectType;
|
|
207
|
+
}
|
|
208
208
|
type MoebiusChromaColorInputType = MoebiusCMYKObjectType | MoebiusLCHObjectType | MoebiusHSLObjectType | MoebiusColorValueHexType | string;
|
|
209
209
|
|
|
210
|
-
/**
|
|
211
|
-
*
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
210
|
+
/**
|
|
211
|
+
* MoebiusColor class representing a color with various formats and conversions.
|
|
212
|
+
* @class
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* const mColor = new MoebiusColor('#ff9900')
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
declare class MoebiusColor implements MoebiusColorInterface {
|
|
219
|
+
color: MoebiusChromaColorInputType;
|
|
220
|
+
name: string;
|
|
221
|
+
hex: MoebiusColorValueHexType;
|
|
222
|
+
rgb: MoebiusColorValueRgbType;
|
|
223
|
+
hsl: MoebiusHSLObjectType;
|
|
224
|
+
hwb: MoebiusHWBObjectType;
|
|
225
|
+
hsv: MoebiusHSVObjectType;
|
|
226
|
+
lab: MoebiusLABObjectType;
|
|
227
|
+
xyz: MoebiusXYZObjectType;
|
|
228
|
+
lch: MoebiusLCHObjectType;
|
|
229
|
+
oklch: MoebiusLCHObjectType;
|
|
230
|
+
hsi: MoebiusHSIObjectType;
|
|
231
|
+
oklab: MoebiusLABObjectType;
|
|
232
|
+
cmyk: MoebiusCMYKObjectType;
|
|
233
|
+
rgbFloat: MoebiusRGBObjectType;
|
|
234
|
+
hslFloat: MoebiusHSLObjectType;
|
|
235
|
+
/**
|
|
236
|
+
* Creates an instance of MoebiusColor.
|
|
237
|
+
* @param {MoebiusChromaColorInputType} value - The hex value of the color.
|
|
238
|
+
* @param {string} name - The name of the color
|
|
239
|
+
* @constructor
|
|
240
|
+
* @throws Will throw an error if init has not been run before creating an instance.
|
|
241
|
+
*/
|
|
242
|
+
constructor(color: MoebiusChromaColorInputType, name: string);
|
|
243
|
+
/**
|
|
244
|
+
* Converts the color to an object in the specified color space.
|
|
245
|
+
* @param {string} type - The color space type (e.g., 'rgb' or 'hsl').
|
|
246
|
+
* @returns {MoebiusRGBObjectType | MoebiusHSLObjectType} The color object in the specified color space.
|
|
247
|
+
*/
|
|
248
|
+
toObject(type?: string): MoebiusRGBObjectType | MoebiusHSLObjectType;
|
|
249
|
+
/**
|
|
250
|
+
* Converts the color to a floating-point representation in the specified color space.
|
|
251
|
+
* @param {string} type - The color space type (e.g., 'rgb' or 'hsl').
|
|
252
|
+
* @returns {MoebiusRGBObjectType | MoebiusHSLObjectType} The floating-point representation of the color in the specified color space.
|
|
253
|
+
*/
|
|
254
|
+
toFloat(type?: string): MoebiusRGBObjectType | MoebiusHSLObjectType;
|
|
229
255
|
}
|
|
230
256
|
|
|
231
|
-
/**
|
|
232
|
-
* MoebiusPalettes class representing a set of color palettes and their variations.
|
|
233
|
-
* @class
|
|
234
|
-
*/
|
|
235
|
-
declare class MoebiusPalettes implements MoebiusPaletteInterface {
|
|
236
|
-
baseColor: MoebiusColorInterface;
|
|
237
|
-
secondaryColor: MoebiusColorInterface;
|
|
238
|
-
colors: Record<string, unknown> | MoebiusPaletteColorsInterface;
|
|
239
|
-
themes: Record<string, unknown> | MoebiusThemeColorsInterface;
|
|
240
|
-
defaultOptions: MoebiusPaletteDefaultOptionsType;
|
|
241
|
-
options: MoebiusPaletteOptionsType;
|
|
242
|
-
all: MoebiusColorValueHexType[];
|
|
243
|
-
accents: MoebiusPaletteAccentColorsInterface;
|
|
244
|
-
/**
|
|
245
|
-
* Creates an instance of MoebiusPalettes.
|
|
246
|
-
* @param {MoebiusPaletteOptionsType} options - Options for configuring the palettes.
|
|
247
|
-
*/
|
|
248
|
-
constructor(options: MoebiusPaletteOptionsType);
|
|
249
|
-
/**
|
|
250
|
-
* Generate a complement color palette based on the input color.
|
|
251
|
-
*
|
|
252
|
-
* @param {MoebiusChromaColorInputType} color - The base color for generating the complement palette.
|
|
253
|
-
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette
|
|
254
|
-
* @param {number} [options.numberOfColors=8] - The number of colors in the complement palette.
|
|
255
|
-
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
256
|
-
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
257
|
-
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the complement palette.
|
|
258
|
-
*
|
|
259
|
-
* @example
|
|
260
|
-
* ```ts
|
|
261
|
-
* const baseColor = '#3498db';
|
|
262
|
-
* const complementPalette = complement(baseColor, { numberOfColors: 5 });
|
|
263
|
-
* console.log(complementPalette); // ['#3498db', '#db3434', '#75db34', '#dbd134', '#db7434']
|
|
264
|
-
* ```
|
|
265
|
-
*/
|
|
266
|
-
complement(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
267
|
-
/**
|
|
268
|
-
* Generates a dark mode color palette based on the provided base and secondary colors.
|
|
269
|
-
* @param {MoebiusChromaColorInputType} baseColor - The base color for the palette.
|
|
270
|
-
* @param {MoebiusChromaColorInputType} secondaryColor - The secondary color for the palette.
|
|
271
|
-
* @param {Record<string, unknown> | MoebiusPaletteOptionsType} [options={}] - Palette options.
|
|
272
|
-
* @param {boolean} [options.bezier=false] - Whether to use bezier interpolation for color scales.
|
|
273
|
-
* @param {string} [options.colorScaleMode] - The color scale mode for chroma.mix.
|
|
274
|
-
* @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors from the palette.
|
|
275
|
-
* @returns {Record<string, MoebiusColorValueHexType[]>} - The generated dark mode color palette.
|
|
276
|
-
* @example
|
|
277
|
-
* ```ts
|
|
278
|
-
* const baseColor = '#3498db';
|
|
279
|
-
* const secondaryColor = '#2ecc71';
|
|
280
|
-
* const options = { bezier: true, colorScaleMode: 'lch' };
|
|
281
|
-
* const palette = darkmode(baseColor, secondaryColor, options);
|
|
282
|
-
* console.log(palette);
|
|
283
|
-
* ```
|
|
284
|
-
*/
|
|
285
|
-
darkmode(baseColor: MoebiusChromaColorInputType, secondaryColor: MoebiusChromaColorInputType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): Record<string, MoebiusColorValueHexType[]>;
|
|
286
|
-
/**
|
|
287
|
-
* Generate a split color palette based on the input color.
|
|
288
|
-
*
|
|
289
|
-
* @param {MoebiusChromaColorInputType} color - The base color for generating the split palette.
|
|
290
|
-
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
291
|
-
* @param {number} [options.numberOfColors=8] - The number of colors in the split palette.
|
|
292
|
-
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
293
|
-
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
294
|
-
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the split palette.
|
|
295
|
-
*
|
|
296
|
-
* @example
|
|
297
|
-
* ```ts
|
|
298
|
-
* const baseColor = '#3498db';
|
|
299
|
-
* const splitPalette = split(baseColor, { numberOfColors: 5 });
|
|
300
|
-
* console.log(splitPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']
|
|
301
|
-
* ```
|
|
302
|
-
*/
|
|
303
|
-
split(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
304
|
-
/**
|
|
305
|
-
* Generates a triadic color palette based on the input color.
|
|
306
|
-
*
|
|
307
|
-
* @param {MoebiusChromaColorInputType} color - The input color in various formats (HEX, RGB, HSL, etc.).
|
|
308
|
-
* @param {Record<string, unknown> | MoebiusPaletteOptionsType} options - Additional options for palette generation.
|
|
309
|
-
* @param {number} [options.numberOfColors=8] - The number of colors in the generated palette.
|
|
310
|
-
* @param {string} [options.colorScaleMode] - The color scale mode for the generated palette.
|
|
311
|
-
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
312
|
-
* @returns {MoebiusColorValueHexType[]} An array of HEX values representing the triadic color palette.
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
* ```ts
|
|
316
|
-
* const triadicPalette = triadic('#3498db', { numberOfColors: 5 });
|
|
317
|
-
* console.log(triadicPalette);
|
|
318
|
-
* // Output: ['#3498db', '#db344f', '#4fdb34', '#9834db', '#34db98']
|
|
319
|
-
* ```
|
|
320
|
-
*/
|
|
321
|
-
triadic(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
322
|
-
/**
|
|
323
|
-
* Generate a tetradic color palette based on the input color.
|
|
324
|
-
*
|
|
325
|
-
* @param {MoebiusChromaColorInputType} color - The base color for generating the tetradic palette.
|
|
326
|
-
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
327
|
-
* @param {number} [options.numberOfColors=8] - The number of colors in the tetradic palette.
|
|
328
|
-
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
329
|
-
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
330
|
-
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the tetradic palette.
|
|
331
|
-
*
|
|
332
|
-
* @example
|
|
333
|
-
* ```ts
|
|
334
|
-
* const baseColor = '#3498db';
|
|
335
|
-
* const tetradicPalette = tetradic(baseColor, { numberOfColors: 5 });
|
|
336
|
-
* console.log(tetradicPalette); // ['#3498db', '#db3434', '#34db99', '#dbd134', '#8f34db']
|
|
337
|
-
* ```
|
|
338
|
-
*/
|
|
339
|
-
tetradic(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
340
|
-
/**
|
|
341
|
-
* Generate a pentadic color palette based on the input color.
|
|
342
|
-
*
|
|
343
|
-
* @param {MoebiusChromaColorInputType} color - The base color for generating the pentadic palette.
|
|
344
|
-
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
345
|
-
* @param {number} [options.numberOfColors=8] - The number of colors in the pentadic palette.
|
|
346
|
-
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
347
|
-
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
348
|
-
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the pentadic palette.
|
|
349
|
-
*
|
|
350
|
-
* @example
|
|
351
|
-
* ```ts
|
|
352
|
-
* const baseColor = '#3498db';
|
|
353
|
-
* const pentadicPalette = pentadic(baseColor, { numberOfColors: 5 });
|
|
354
|
-
* console.log(pentadicPalette); // ['#3498db', '#dbd134', '#db3434', '#34db99', '#8f34db']
|
|
355
|
-
* ```
|
|
356
|
-
*/
|
|
357
|
-
pentadic(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
358
|
-
/**
|
|
359
|
-
* Generate a hexadic color palette based on the input color.
|
|
360
|
-
*
|
|
361
|
-
* @param {MoebiusChromaColorInputType} color - The base color for generating the hexadic palette.
|
|
362
|
-
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
363
|
-
* @param {number} [options.numberOfColors=8] - The number of colors in the hexadic palette.
|
|
364
|
-
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
365
|
-
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
366
|
-
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the hexadic palette.
|
|
367
|
-
*
|
|
368
|
-
* @example
|
|
369
|
-
* ```ts
|
|
370
|
-
* const baseColor = '#3498db';
|
|
371
|
-
* const hexadicPalette = hexadic(baseColor, { numberOfColors: 5 });
|
|
372
|
-
* console.log(hexadicPalette); // ['#3498db', '#5d7f33', '#8473a9', '#ad7a95', '#db3434']
|
|
373
|
-
* ```
|
|
374
|
-
*/
|
|
375
|
-
hexadic(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
376
|
-
/**
|
|
377
|
-
* Generate an analogous color palette based on the input color.
|
|
378
|
-
*
|
|
379
|
-
* @param {MoebiusChromaColorInputType} color - The base color for generating the analogous palette.
|
|
380
|
-
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
381
|
-
* @param {number} [options.numberOfColors=8] - The number of colors in the analogous palette.
|
|
382
|
-
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
383
|
-
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
384
|
-
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the analogous palette.
|
|
385
|
-
*
|
|
386
|
-
* @example
|
|
387
|
-
* ```ts
|
|
388
|
-
* const baseColor = '#3498db';
|
|
389
|
-
* const analogousPalette = analogous(baseColor, { numberOfColors: 5 });
|
|
390
|
-
* console.log(analogousPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#db3474']
|
|
391
|
-
* ```
|
|
392
|
-
*/
|
|
393
|
-
analogous(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
394
|
-
/**
|
|
395
|
-
* Interpolate between two colors and generate a color palette.
|
|
396
|
-
*
|
|
397
|
-
* @param {MoebiusChromaColorInputType} primaryColor - The starting color for interpolation.
|
|
398
|
-
* @param {MoebiusChromaColorInputType} secondaryColor - The ending color for interpolation.
|
|
399
|
-
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
400
|
-
* @param {number} [options.numberOfColors=8] - The number of colors in the interpolated palette.
|
|
401
|
-
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
402
|
-
* @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.
|
|
403
|
-
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
404
|
-
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the interpolated palette.
|
|
405
|
-
*
|
|
406
|
-
* @example
|
|
407
|
-
* ```ts
|
|
408
|
-
* const startColor = '#3498db';
|
|
409
|
-
* const endColor = '#db3434';
|
|
410
|
-
* const interpolatedPalette = interpolate(startColor, endColor, { numberOfColors: 5 });
|
|
411
|
-
* console.log(interpolatedPalette); // ['#3498db', '#5d6d7e', '#8473a9', '#ad7a95', '#db3434']
|
|
412
|
-
* ```
|
|
413
|
-
*/
|
|
414
|
-
interpolate(primaryColor: MoebiusColorValueHexType, secondaryColor: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
415
|
-
/**
|
|
416
|
-
* Generate a luminance shift palette based on an array of colors, with optional diverging colors.
|
|
417
|
-
*
|
|
418
|
-
* @param {MoebiusChromaColorInputType[]} colors - Array of base colors for generating the luminance shift palette.
|
|
419
|
-
* @param {MoebiusChromaColorInputType[]} [divergingColors=[]] - Array of diverging colors.
|
|
420
|
-
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
421
|
-
* @param {number} [options.numberOfColors=8] - The total number of colors in the luminance shift palette.
|
|
422
|
-
* @param {boolean} [options.diverging=false] - Whether to generate a diverging palette.
|
|
423
|
-
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
424
|
-
* @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.
|
|
425
|
-
* @param {string} [options.divergentColor='#f5f5f5'] - The divergent color for a diverging palette.
|
|
426
|
-
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
427
|
-
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the luminance shift palette.
|
|
428
|
-
*
|
|
429
|
-
* @example
|
|
430
|
-
* ```ts
|
|
431
|
-
* const baseColors = ['#3498db', '#99db34'];
|
|
432
|
-
* const divergingColors = ['#db3434'];
|
|
433
|
-
* const luminanceShiftPalette = luminanceShift(baseColors, divergingColors, { numberOfColors: 5 });
|
|
434
|
-
* console.log(luminanceShiftPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']
|
|
435
|
-
* ```
|
|
436
|
-
*/
|
|
437
|
-
luminanceShift(colors: MoebiusColorValueHexType[], divergingColors?: MoebiusColorValueHexType[], options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
438
|
-
/**
|
|
439
|
-
* Generates a monochromatic color palette based on the given color.
|
|
440
|
-
* @param {MoebiusChromaColorInputType} color - The base color for the palette.
|
|
441
|
-
* @param {MoebiusPaletteOptionsType} options - Options for generating the palette.
|
|
442
|
-
* @returns {MoebiusColorValueHexType[]} - An array of hex color values in the palette.
|
|
443
|
-
* @example
|
|
444
|
-
* ```typescript
|
|
445
|
-
* const baseColor = '#003f5c';
|
|
446
|
-
* const options = { numberOfColors: 5, bezier: true, randomOffset: false };
|
|
447
|
-
* const monochromaticPalette = monochromatic(baseColor, options);
|
|
448
|
-
* console.log(monochromaticPalette);
|
|
449
|
-
* [
|
|
450
|
-
* '#003f5c', // maniacMansion,
|
|
451
|
-
* '#014268', // darkImperialBlue,
|
|
452
|
-
* '#024575', // macraggeBlue,
|
|
453
|
-
* '#044784', // bridgeport,
|
|
454
|
-
* '#064898', // frightNight,
|
|
455
|
-
* '#0745b6', // absoluteZero,
|
|
456
|
-
* '#002df5', // blueBouquet
|
|
457
|
-
* ];
|
|
458
|
-
* ```
|
|
459
|
-
*/
|
|
460
|
-
monochromatic(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
461
|
-
/**
|
|
462
|
-
* Generate a harmonized color palette based on the input color.
|
|
463
|
-
*
|
|
464
|
-
* @param {MoebiusChromaColorInputType} color - The base color for generating the harmonized palette.
|
|
465
|
-
* @param {number} start - The starting angle for generating harmonized colors (degrees).
|
|
466
|
-
* @param {number} end - The ending angle for generating harmonized colors (degrees).
|
|
467
|
-
* @param {number} interval - The interval between harmonized colors (degrees).
|
|
468
|
-
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
469
|
-
* @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors in the palette.
|
|
470
|
-
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the harmonized palette.
|
|
471
|
-
*
|
|
472
|
-
* @example
|
|
473
|
-
* ```ts
|
|
474
|
-
* const baseColor = '#3498db';
|
|
475
|
-
* const harmonizedPalette = harmonize(baseColor, 30, 210, 30, { noDuplicates: true });
|
|
476
|
-
* console.log(harmonizedPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#3498db']
|
|
477
|
-
* ```
|
|
478
|
-
*/
|
|
479
|
-
harmonize(color: MoebiusColorValueHexType, start: number, end: number, interval: number, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
257
|
+
/**
|
|
258
|
+
* MoebiusPalettes class representing a set of color palettes and their variations.
|
|
259
|
+
* @class
|
|
260
|
+
*/
|
|
261
|
+
declare class MoebiusPalettes implements MoebiusPaletteInterface {
|
|
262
|
+
baseColor: MoebiusColorInterface;
|
|
263
|
+
secondaryColor: MoebiusColorInterface;
|
|
264
|
+
colors: Record<string, unknown> | MoebiusPaletteColorsInterface;
|
|
265
|
+
themes: Record<string, unknown> | MoebiusThemeColorsInterface;
|
|
266
|
+
defaultOptions: MoebiusPaletteDefaultOptionsType;
|
|
267
|
+
options: MoebiusPaletteOptionsType;
|
|
268
|
+
all: MoebiusColorValueHexType[];
|
|
269
|
+
accents: MoebiusPaletteAccentColorsInterface;
|
|
270
|
+
/**
|
|
271
|
+
* Creates an instance of MoebiusPalettes.
|
|
272
|
+
* @param {MoebiusPaletteOptionsType} options - Options for configuring the palettes.
|
|
273
|
+
*/
|
|
274
|
+
constructor(options: MoebiusPaletteOptionsType);
|
|
275
|
+
/**
|
|
276
|
+
* Generate a complement color palette based on the input color.
|
|
277
|
+
*
|
|
278
|
+
* @param {MoebiusChromaColorInputType} color - The base color for generating the complement palette.
|
|
279
|
+
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.<
|
|
280
|
+
* @param {number} [options.numberOfColors=8] - The number of colors in the complement palette.
|
|
281
|
+
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
282
|
+
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
283
|
+
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the complement palette.
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```ts
|
|
287
|
+
* const baseColor = '#3498db';
|
|
288
|
+
* const complementPalette = complement(baseColor, { numberOfColors: 5 });
|
|
289
|
+
* console.log(complementPalette); // ['#3498db', '#db3434', '#75db34', '#dbd134', '#db7434']
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
complement(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
293
|
+
/**
|
|
294
|
+
* Generates a dark mode color palette based on the provided base and secondary colors.
|
|
295
|
+
* @param {MoebiusChromaColorInputType} baseColor - The base color for the palette.
|
|
296
|
+
* @param {MoebiusChromaColorInputType} secondaryColor - The secondary color for the palette.
|
|
297
|
+
* @param {Record<string, unknown> | MoebiusPaletteOptionsType} [options={}] - Palette options.
|
|
298
|
+
* @param {boolean} [options.bezier=false] - Whether to use bezier interpolation for color scales.
|
|
299
|
+
* @param {string} [options.colorScaleMode] - The color scale mode for chroma.mix.
|
|
300
|
+
* @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors from the palette.
|
|
301
|
+
* @returns {Record<string, MoebiusColorValueHexType[]>} - The generated dark mode color palette.
|
|
302
|
+
* @example
|
|
303
|
+
* ```ts
|
|
304
|
+
* const baseColor = '#3498db';
|
|
305
|
+
* const secondaryColor = '#2ecc71';
|
|
306
|
+
* const options = { bezier: true, colorScaleMode: 'lch' };
|
|
307
|
+
* const palette = darkmode(baseColor, secondaryColor, options);
|
|
308
|
+
* console.log(palette);
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
darkmode(baseColor: MoebiusChromaColorInputType, secondaryColor: MoebiusChromaColorInputType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): Record<string, MoebiusColorValueHexType[]>;
|
|
312
|
+
/**
|
|
313
|
+
* Generate a split color palette based on the input color.
|
|
314
|
+
*
|
|
315
|
+
* @param {MoebiusChromaColorInputType} color - The base color for generating the split palette.
|
|
316
|
+
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
317
|
+
* @param {number} [options.numberOfColors=8] - The number of colors in the split palette.
|
|
318
|
+
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
319
|
+
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
320
|
+
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the split palette.
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* ```ts
|
|
324
|
+
* const baseColor = '#3498db';
|
|
325
|
+
* const splitPalette = split(baseColor, { numberOfColors: 5 });
|
|
326
|
+
* console.log(splitPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']
|
|
327
|
+
* ```
|
|
328
|
+
*/
|
|
329
|
+
split(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
330
|
+
/**
|
|
331
|
+
* Generates a triadic color palette based on the input color.
|
|
332
|
+
*
|
|
333
|
+
* @param {MoebiusChromaColorInputType} color - The input color in various formats (HEX, RGB, HSL, etc.).
|
|
334
|
+
* @param {Record<string, unknown> | MoebiusPaletteOptionsType} options - Additional options for palette generation.
|
|
335
|
+
* @param {number} [options.numberOfColors=8] - The number of colors in the generated palette.
|
|
336
|
+
* @param {string} [options.colorScaleMode] - The color scale mode for the generated palette.
|
|
337
|
+
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
338
|
+
* @returns {MoebiusColorValueHexType[]} An array of HEX values representing the triadic color palette.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* const triadicPalette = triadic('#3498db', { numberOfColors: 5 });
|
|
343
|
+
* console.log(triadicPalette);
|
|
344
|
+
* // Output: ['#3498db', '#db344f', '#4fdb34', '#9834db', '#34db98']
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
triadic(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
348
|
+
/**
|
|
349
|
+
* Generate a tetradic color palette based on the input color.
|
|
350
|
+
*
|
|
351
|
+
* @param {MoebiusChromaColorInputType} color - The base color for generating the tetradic palette.
|
|
352
|
+
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
353
|
+
* @param {number} [options.numberOfColors=8] - The number of colors in the tetradic palette.
|
|
354
|
+
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
355
|
+
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
356
|
+
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the tetradic palette.
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```ts
|
|
360
|
+
* const baseColor = '#3498db';
|
|
361
|
+
* const tetradicPalette = tetradic(baseColor, { numberOfColors: 5 });
|
|
362
|
+
* console.log(tetradicPalette); // ['#3498db', '#db3434', '#34db99', '#dbd134', '#8f34db']
|
|
363
|
+
* ```
|
|
364
|
+
*/
|
|
365
|
+
tetradic(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
366
|
+
/**
|
|
367
|
+
* Generate a pentadic color palette based on the input color.
|
|
368
|
+
*
|
|
369
|
+
* @param {MoebiusChromaColorInputType} color - The base color for generating the pentadic palette.
|
|
370
|
+
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
371
|
+
* @param {number} [options.numberOfColors=8] - The number of colors in the pentadic palette.
|
|
372
|
+
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
373
|
+
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
374
|
+
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the pentadic palette.
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```ts
|
|
378
|
+
* const baseColor = '#3498db';
|
|
379
|
+
* const pentadicPalette = pentadic(baseColor, { numberOfColors: 5 });
|
|
380
|
+
* console.log(pentadicPalette); // ['#3498db', '#dbd134', '#db3434', '#34db99', '#8f34db']
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
pentadic(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
384
|
+
/**
|
|
385
|
+
* Generate a hexadic color palette based on the input color.
|
|
386
|
+
*
|
|
387
|
+
* @param {MoebiusChromaColorInputType} color - The base color for generating the hexadic palette.
|
|
388
|
+
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
389
|
+
* @param {number} [options.numberOfColors=8] - The number of colors in the hexadic palette.
|
|
390
|
+
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
391
|
+
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
392
|
+
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the hexadic palette.
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```ts
|
|
396
|
+
* const baseColor = '#3498db';
|
|
397
|
+
* const hexadicPalette = hexadic(baseColor, { numberOfColors: 5 });
|
|
398
|
+
* console.log(hexadicPalette); // ['#3498db', '#5d7f33', '#8473a9', '#ad7a95', '#db3434']
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
hexadic(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
402
|
+
/**
|
|
403
|
+
* Generate an analogous color palette based on the input color.
|
|
404
|
+
*
|
|
405
|
+
* @param {MoebiusChromaColorInputType} color - The base color for generating the analogous palette.
|
|
406
|
+
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
407
|
+
* @param {number} [options.numberOfColors=8] - The number of colors in the analogous palette.
|
|
408
|
+
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
409
|
+
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
410
|
+
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the analogous palette.
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```ts
|
|
414
|
+
* const baseColor = '#3498db';
|
|
415
|
+
* const analogousPalette = analogous(baseColor, { numberOfColors: 5 });
|
|
416
|
+
* console.log(analogousPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#db3474']
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
analogous(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
420
|
+
/**
|
|
421
|
+
* Interpolate between two colors and generate a color palette.
|
|
422
|
+
*
|
|
423
|
+
* @param {MoebiusChromaColorInputType} primaryColor - The starting color for interpolation.
|
|
424
|
+
* @param {MoebiusChromaColorInputType} secondaryColor - The ending color for interpolation.
|
|
425
|
+
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
426
|
+
* @param {number} [options.numberOfColors=8] - The number of colors in the interpolated palette.
|
|
427
|
+
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
428
|
+
* @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.
|
|
429
|
+
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
430
|
+
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the interpolated palette.
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```ts
|
|
434
|
+
* const startColor = '#3498db';
|
|
435
|
+
* const endColor = '#db3434';
|
|
436
|
+
* const interpolatedPalette = interpolate(startColor, endColor, { numberOfColors: 5 });
|
|
437
|
+
* console.log(interpolatedPalette); // ['#3498db', '#5d6d7e', '#8473a9', '#ad7a95', '#db3434']
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
interpolate(primaryColor: MoebiusColorValueHexType, secondaryColor: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
441
|
+
/**
|
|
442
|
+
* Generate a luminance shift palette based on an array of colors, with optional diverging colors.
|
|
443
|
+
*
|
|
444
|
+
* @param {MoebiusChromaColorInputType[]} colors - Array of base colors for generating the luminance shift palette.
|
|
445
|
+
* @param {MoebiusChromaColorInputType[]} [divergingColors=[]] - Array of diverging colors.
|
|
446
|
+
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
447
|
+
* @param {number} [options.numberOfColors=8] - The total number of colors in the luminance shift palette.
|
|
448
|
+
* @param {boolean} [options.diverging=false] - Whether to generate a diverging palette.
|
|
449
|
+
* @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.
|
|
450
|
+
* @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.
|
|
451
|
+
* @param {string} [options.divergentColor='#f5f5f5'] - The divergent color for a diverging palette.
|
|
452
|
+
* @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.
|
|
453
|
+
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the luminance shift palette.
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```ts
|
|
457
|
+
* const baseColors = ['#3498db', '#99db34'];
|
|
458
|
+
* const divergingColors = ['#db3434'];
|
|
459
|
+
* const luminanceShiftPalette = luminanceShift(baseColors, divergingColors, { numberOfColors: 5 });
|
|
460
|
+
* console.log(luminanceShiftPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
luminanceShift(colors: MoebiusColorValueHexType[], divergingColors?: MoebiusColorValueHexType[], options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
464
|
+
/**
|
|
465
|
+
* Generates a monochromatic color palette based on the given color.
|
|
466
|
+
* @param {MoebiusChromaColorInputType} color - The base color for the palette.
|
|
467
|
+
* @param {MoebiusPaletteOptionsType} options - Options for generating the palette.
|
|
468
|
+
* @returns {MoebiusColorValueHexType[]} - An array of hex color values in the palette.
|
|
469
|
+
* @example
|
|
470
|
+
* ```typescript
|
|
471
|
+
* const baseColor = '#003f5c';
|
|
472
|
+
* const options = { numberOfColors: 5, bezier: true, randomOffset: false };
|
|
473
|
+
* const monochromaticPalette = monochromatic(baseColor, options);
|
|
474
|
+
* console.log(monochromaticPalette);
|
|
475
|
+
* [
|
|
476
|
+
* '#003f5c', // maniacMansion,
|
|
477
|
+
* '#014268', // darkImperialBlue,
|
|
478
|
+
* '#024575', // macraggeBlue,
|
|
479
|
+
* '#044784', // bridgeport,
|
|
480
|
+
* '#064898', // frightNight,
|
|
481
|
+
* '#0745b6', // absoluteZero,
|
|
482
|
+
* '#002df5', // blueBouquet
|
|
483
|
+
* ];
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
monochromatic(color: MoebiusColorValueHexType, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
487
|
+
/**
|
|
488
|
+
* Generate a harmonized color palette based on the input color.
|
|
489
|
+
*
|
|
490
|
+
* @param {MoebiusChromaColorInputType} color - The base color for generating the harmonized palette.
|
|
491
|
+
* @param {number} start - The starting angle for generating harmonized colors (degrees).
|
|
492
|
+
* @param {number} end - The ending angle for generating harmonized colors (degrees).
|
|
493
|
+
* @param {number} interval - The interval between harmonized colors (degrees).
|
|
494
|
+
* @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.
|
|
495
|
+
* @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors in the palette.
|
|
496
|
+
* @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the harmonized palette.
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```ts
|
|
500
|
+
* const baseColor = '#3498db';
|
|
501
|
+
* const harmonizedPalette = harmonize(baseColor, 30, 210, 30, { noDuplicates: true });
|
|
502
|
+
* console.log(harmonizedPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#3498db']
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
harmonize(color: MoebiusColorValueHexType, start: number, end: number, interval: number, options?: Record<string, unknown> | MoebiusPaletteOptionsType): MoebiusColorValueHexType[];
|
|
480
506
|
}
|
|
481
507
|
|
|
482
|
-
/**
|
|
483
|
-
*
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
oklch: MoebiusLCHObjectType;
|
|
502
|
-
hsi: MoebiusHSIObjectType;
|
|
503
|
-
oklab: MoebiusLABObjectType;
|
|
504
|
-
cmyk: MoebiusCMYKObjectType;
|
|
505
|
-
rgbFloat: MoebiusRGBObjectType;
|
|
506
|
-
hslFloat: MoebiusHSLObjectType;
|
|
507
|
-
/**
|
|
508
|
-
* Creates an instance of MoebiusColor.
|
|
509
|
-
* @param {MoebiusChromaColorInputType} value - The hex value of the color.
|
|
510
|
-
* @param {string} name - The name of the color
|
|
511
|
-
* @constructor
|
|
512
|
-
* @throws Will throw an error if init has not been run before creating an instance.
|
|
513
|
-
*/
|
|
514
|
-
constructor(color: MoebiusChromaColorInputType, name: string);
|
|
515
|
-
/**
|
|
516
|
-
* Converts the color to an object in the specified color space.
|
|
517
|
-
* @param {string} type - The color space type (e.g., 'rgb' or 'hsl').
|
|
518
|
-
* @returns {MoebiusRGBObjectType | MoebiusHSLObjectType} The color object in the specified color space.
|
|
519
|
-
*/
|
|
520
|
-
toObject(type?: string): MoebiusRGBObjectType | MoebiusHSLObjectType;
|
|
521
|
-
/**
|
|
522
|
-
* Converts the color to a floating-point representation in the specified color space.
|
|
523
|
-
* @param {string} type - The color space type (e.g., 'rgb' or 'hsl').
|
|
524
|
-
* @returns {MoebiusRGBObjectType | MoebiusHSLObjectType} The floating-point representation of the color in the specified color space.
|
|
525
|
-
*/
|
|
526
|
-
toFloat(type?: string): MoebiusRGBObjectType | MoebiusHSLObjectType;
|
|
508
|
+
/**
|
|
509
|
+
* Helper class for generating SVG paths for colored pie slices.
|
|
510
|
+
*/
|
|
511
|
+
declare class MoebiusSVGHelper {
|
|
512
|
+
xlmns: string;
|
|
513
|
+
/**
|
|
514
|
+
* Gets SVG paths for colored pie slices based on the provided colors.
|
|
515
|
+
* @param {MoebiusColorValueHexType[][]} colors - Array of color groups.
|
|
516
|
+
* @param {number} [size=256] - Size of the SVG.
|
|
517
|
+
* @returns {DocumentFragment} - Document fragment containing the SVG paths.
|
|
518
|
+
* @example
|
|
519
|
+
* ```ts
|
|
520
|
+
* const svgHelper = new MoebiusSVGHelper();
|
|
521
|
+
* const colors = [['#ff0000', '#00ff00'], ['#0000ff']];
|
|
522
|
+
* const svgFragment = svgHelper.getColorPiePaths(colors, 256);
|
|
523
|
+
* document.body.appendChild(svgFragment);
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
getColorPiePaths(colors: MoebiusColorValueHexType[][], size?: number): DocumentFragment;
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
-
type MoebiusReturnType = Promise<{
|
|
530
|
-
MoebiusColor: typeof MoebiusColor;
|
|
531
|
-
MoebiusPalettes: typeof MoebiusPalettes;
|
|
532
|
-
MoebiusSVGHelper: typeof MoebiusSVGHelper;
|
|
533
|
-
}>;
|
|
534
|
-
/**
|
|
535
|
-
* Asynchronous function to initialize Moebius with required data
|
|
536
|
-
* @function
|
|
537
|
-
* @returns {MoebiusReturnType} An object with Moebius classes
|
|
538
|
-
*
|
|
539
|
-
*/
|
|
529
|
+
type MoebiusReturnType = Promise<{
|
|
530
|
+
MoebiusColor: typeof MoebiusColor;
|
|
531
|
+
MoebiusPalettes: typeof MoebiusPalettes;
|
|
532
|
+
MoebiusSVGHelper: typeof MoebiusSVGHelper;
|
|
533
|
+
}>;
|
|
534
|
+
/**
|
|
535
|
+
* Asynchronous function to initialize Moebius with required data
|
|
536
|
+
* @function
|
|
537
|
+
* @returns {MoebiusReturnType} An object with Moebius classes
|
|
538
|
+
*
|
|
539
|
+
*/
|
|
540
540
|
declare function Moebius(): MoebiusReturnType;
|
|
541
541
|
|
|
542
|
-
export { MoebiusCMYKObjectType, MoebiusChromaColorInputType, MoebiusColorInterface, MoebiusColorValueHexType, MoebiusColorValueHslType, MoebiusColorValueHslaType, MoebiusColorValueRgbType, MoebiusColorValueRgbaType, MoebiusHSIObjectType, MoebiusHSLObjectType, MoebiusHSVObjectType, MoebiusHWBObjectType, MoebiusLABObjectType, MoebiusLCHObjectType, MoebiusPaletteAccentColorsInterface, MoebiusPaletteColorsInterface, MoebiusPaletteDefaultOptionsType, MoebiusPaletteInterface, MoebiusPaletteOptionsType, MoebiusRGBObjectType, MoebiusReturnType, MoebiusThemeColorsInterface, MoebiusXYZObjectType, NearestColorColorMatchInterface, NearestColorColorSpecInterface, Moebius as default };
|
|
542
|
+
export { type MoebiusCMYKObjectType, type MoebiusChromaColorInputType, type MoebiusColorInterface, type MoebiusColorValueHexType, type MoebiusColorValueHslType, type MoebiusColorValueHslaType, type MoebiusColorValueRgbType, type MoebiusColorValueRgbaType, type MoebiusHSIObjectType, type MoebiusHSLObjectType, type MoebiusHSVObjectType, type MoebiusHWBObjectType, type MoebiusLABObjectType, type MoebiusLCHObjectType, type MoebiusPaletteAccentColorsInterface, type MoebiusPaletteColorsInterface, type MoebiusPaletteDefaultOptionsType, type MoebiusPaletteInterface, type MoebiusPaletteOptionsType, type MoebiusRGBObjectType, type MoebiusReturnType, type MoebiusThemeColorsInterface, type MoebiusXYZObjectType, type NearestColorColorMatchInterface, type NearestColorColorSpecInterface, Moebius as default };
|