@bitbybit-dev/base 0.20.12 → 0.20.14
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/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/inputs/lists-inputs.d.ts +39 -0
- package/lib/api/inputs/lists-inputs.js +43 -0
- package/lib/api/inputs/math-inputs.d.ts +154 -0
- package/lib/api/inputs/math-inputs.js +217 -0
- package/lib/api/inputs/text-inputs.d.ts +139 -0
- package/lib/api/inputs/text-inputs.js +215 -0
- package/lib/api/inputs/vector-inputs.d.ts +8 -0
- package/lib/api/inputs/vector-inputs.js +8 -0
- package/lib/api/services/color.d.ts +27 -12
- package/lib/api/services/color.js +27 -12
- package/lib/api/services/dates.d.ts +62 -30
- package/lib/api/services/dates.js +62 -30
- package/lib/api/services/geometry-helper.d.ts +50 -0
- package/lib/api/services/geometry-helper.js +50 -2
- package/lib/api/services/helpers/dxf/dxf.d.ts +19 -9
- package/lib/api/services/helpers/dxf/dxf.js +19 -9
- package/lib/api/services/line.d.ts +34 -16
- package/lib/api/services/line.js +34 -16
- package/lib/api/services/lists.d.ts +175 -32
- package/lib/api/services/lists.js +275 -32
- package/lib/api/services/logic.d.ts +24 -13
- package/lib/api/services/logic.js +24 -13
- package/lib/api/services/math.d.ts +180 -35
- package/lib/api/services/math.js +215 -35
- package/lib/api/services/mesh.d.ts +17 -6
- package/lib/api/services/mesh.js +17 -6
- package/lib/api/services/point.d.ts +63 -32
- package/lib/api/services/point.js +63 -32
- package/lib/api/services/polyline.d.ts +27 -11
- package/lib/api/services/polyline.js +27 -11
- package/lib/api/services/text.d.ts +286 -7
- package/lib/api/services/text.js +350 -7
- package/lib/api/services/transforms.d.ts +30 -16
- package/lib/api/services/transforms.js +30 -16
- package/lib/api/services/vector.d.ts +85 -38
- package/lib/api/services/vector.js +87 -38
- package/package.json +1 -1
|
@@ -117,6 +117,221 @@ export var Text;
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
Text.TextFormatDto = TextFormatDto;
|
|
120
|
+
class TextSearchDto {
|
|
121
|
+
constructor(text, search) {
|
|
122
|
+
/**
|
|
123
|
+
* Text to search in
|
|
124
|
+
* @default hello world
|
|
125
|
+
*/
|
|
126
|
+
this.text = "hello world";
|
|
127
|
+
/**
|
|
128
|
+
* Text to search for
|
|
129
|
+
* @default world
|
|
130
|
+
*/
|
|
131
|
+
this.search = "world";
|
|
132
|
+
if (text !== undefined) {
|
|
133
|
+
this.text = text;
|
|
134
|
+
}
|
|
135
|
+
if (search !== undefined) {
|
|
136
|
+
this.search = search;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
Text.TextSearchDto = TextSearchDto;
|
|
141
|
+
class TextSubstringDto {
|
|
142
|
+
constructor(text, start, end) {
|
|
143
|
+
/**
|
|
144
|
+
* Text to extract from
|
|
145
|
+
* @default hello world
|
|
146
|
+
*/
|
|
147
|
+
this.text = "hello world";
|
|
148
|
+
/**
|
|
149
|
+
* Start index
|
|
150
|
+
* @default 0
|
|
151
|
+
* @minimum 0
|
|
152
|
+
* @maximum Infinity
|
|
153
|
+
* @step 1
|
|
154
|
+
*/
|
|
155
|
+
this.start = 0;
|
|
156
|
+
/**
|
|
157
|
+
* End index
|
|
158
|
+
* @default 5
|
|
159
|
+
* @minimum 0
|
|
160
|
+
* @maximum Infinity
|
|
161
|
+
* @step 1
|
|
162
|
+
*/
|
|
163
|
+
this.end = 5;
|
|
164
|
+
if (text !== undefined) {
|
|
165
|
+
this.text = text;
|
|
166
|
+
}
|
|
167
|
+
if (start !== undefined) {
|
|
168
|
+
this.start = start;
|
|
169
|
+
}
|
|
170
|
+
if (end !== undefined) {
|
|
171
|
+
this.end = end;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
Text.TextSubstringDto = TextSubstringDto;
|
|
176
|
+
class TextIndexDto {
|
|
177
|
+
constructor(text, index) {
|
|
178
|
+
/**
|
|
179
|
+
* Text to get character from
|
|
180
|
+
* @default hello
|
|
181
|
+
*/
|
|
182
|
+
this.text = "hello";
|
|
183
|
+
/**
|
|
184
|
+
* Index of character
|
|
185
|
+
* @default 0
|
|
186
|
+
* @minimum 0
|
|
187
|
+
* @maximum Infinity
|
|
188
|
+
* @step 1
|
|
189
|
+
*/
|
|
190
|
+
this.index = 0;
|
|
191
|
+
if (text !== undefined) {
|
|
192
|
+
this.text = text;
|
|
193
|
+
}
|
|
194
|
+
if (index !== undefined) {
|
|
195
|
+
this.index = index;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
Text.TextIndexDto = TextIndexDto;
|
|
200
|
+
class TextPadDto {
|
|
201
|
+
constructor(text, length, padString) {
|
|
202
|
+
/**
|
|
203
|
+
* Text to pad
|
|
204
|
+
* @default x
|
|
205
|
+
*/
|
|
206
|
+
this.text = "x";
|
|
207
|
+
/**
|
|
208
|
+
* Target length
|
|
209
|
+
* @default 3
|
|
210
|
+
* @minimum 0
|
|
211
|
+
* @maximum Infinity
|
|
212
|
+
* @step 1
|
|
213
|
+
*/
|
|
214
|
+
this.length = 3;
|
|
215
|
+
/**
|
|
216
|
+
* String to pad with
|
|
217
|
+
* @default a
|
|
218
|
+
*/
|
|
219
|
+
this.padString = "a";
|
|
220
|
+
if (text !== undefined) {
|
|
221
|
+
this.text = text;
|
|
222
|
+
}
|
|
223
|
+
if (length !== undefined) {
|
|
224
|
+
this.length = length;
|
|
225
|
+
}
|
|
226
|
+
if (padString !== undefined) {
|
|
227
|
+
this.padString = padString;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
Text.TextPadDto = TextPadDto;
|
|
232
|
+
class TextRepeatDto {
|
|
233
|
+
constructor(text, count) {
|
|
234
|
+
/**
|
|
235
|
+
* Text to repeat
|
|
236
|
+
* @default ha
|
|
237
|
+
*/
|
|
238
|
+
this.text = "ha";
|
|
239
|
+
/**
|
|
240
|
+
* Number of repetitions
|
|
241
|
+
* @default 3
|
|
242
|
+
* @minimum 0
|
|
243
|
+
* @maximum Infinity
|
|
244
|
+
* @step 1
|
|
245
|
+
*/
|
|
246
|
+
this.count = 3;
|
|
247
|
+
if (text !== undefined) {
|
|
248
|
+
this.text = text;
|
|
249
|
+
}
|
|
250
|
+
if (count !== undefined) {
|
|
251
|
+
this.count = count;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
Text.TextRepeatDto = TextRepeatDto;
|
|
256
|
+
class TextConcatDto {
|
|
257
|
+
constructor(texts) {
|
|
258
|
+
/**
|
|
259
|
+
* Texts to concatenate
|
|
260
|
+
* @default ["hello", " ", "world"]
|
|
261
|
+
*/
|
|
262
|
+
this.texts = ["hello", " ", "world"];
|
|
263
|
+
if (texts !== undefined) {
|
|
264
|
+
this.texts = texts;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
Text.TextConcatDto = TextConcatDto;
|
|
269
|
+
class TextRegexDto {
|
|
270
|
+
constructor(text, pattern, flags) {
|
|
271
|
+
/**
|
|
272
|
+
* Text to search in
|
|
273
|
+
* @default hello123world
|
|
274
|
+
*/
|
|
275
|
+
this.text = "hello123world";
|
|
276
|
+
/**
|
|
277
|
+
* Regular expression pattern
|
|
278
|
+
* @default [0-9]+
|
|
279
|
+
*/
|
|
280
|
+
this.pattern = "[0-9]+";
|
|
281
|
+
/**
|
|
282
|
+
* Regular expression flags (g, i, m, s, u, y)
|
|
283
|
+
* @default g
|
|
284
|
+
*/
|
|
285
|
+
this.flags = "g";
|
|
286
|
+
if (text !== undefined) {
|
|
287
|
+
this.text = text;
|
|
288
|
+
}
|
|
289
|
+
if (pattern !== undefined) {
|
|
290
|
+
this.pattern = pattern;
|
|
291
|
+
}
|
|
292
|
+
if (flags !== undefined) {
|
|
293
|
+
this.flags = flags;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
Text.TextRegexDto = TextRegexDto;
|
|
298
|
+
class TextRegexReplaceDto {
|
|
299
|
+
constructor(text, pattern, flags, replaceWith) {
|
|
300
|
+
/**
|
|
301
|
+
* Text to search in
|
|
302
|
+
* @default hello123world456
|
|
303
|
+
*/
|
|
304
|
+
this.text = "hello123world456";
|
|
305
|
+
/**
|
|
306
|
+
* Regular expression pattern
|
|
307
|
+
* @default [0-9]+
|
|
308
|
+
*/
|
|
309
|
+
this.pattern = "[0-9]+";
|
|
310
|
+
/**
|
|
311
|
+
* Regular expression flags (g, i, m, s, u, y)
|
|
312
|
+
* @default g
|
|
313
|
+
*/
|
|
314
|
+
this.flags = "g";
|
|
315
|
+
/**
|
|
316
|
+
* Text to replace matches with
|
|
317
|
+
* @default X
|
|
318
|
+
*/
|
|
319
|
+
this.replaceWith = "X";
|
|
320
|
+
if (text !== undefined) {
|
|
321
|
+
this.text = text;
|
|
322
|
+
}
|
|
323
|
+
if (pattern !== undefined) {
|
|
324
|
+
this.pattern = pattern;
|
|
325
|
+
}
|
|
326
|
+
if (flags !== undefined) {
|
|
327
|
+
this.flags = flags;
|
|
328
|
+
}
|
|
329
|
+
if (replaceWith !== undefined) {
|
|
330
|
+
this.replaceWith = replaceWith;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
Text.TextRegexReplaceDto = TextRegexReplaceDto;
|
|
120
335
|
class VectorCharDto {
|
|
121
336
|
constructor(char, xOffset, yOffset, height, extrudeOffset) {
|
|
122
337
|
/**
|
|
@@ -85,6 +85,14 @@ export declare namespace Vector {
|
|
|
85
85
|
*/
|
|
86
86
|
vector: number[];
|
|
87
87
|
}
|
|
88
|
+
class VectorStringDto {
|
|
89
|
+
constructor(vector?: string[]);
|
|
90
|
+
/**
|
|
91
|
+
* Vector array of stringified numbers
|
|
92
|
+
* @default undefined
|
|
93
|
+
*/
|
|
94
|
+
vector: string[];
|
|
95
|
+
}
|
|
88
96
|
class Vector3Dto {
|
|
89
97
|
constructor(vector?: Base.Vector3);
|
|
90
98
|
/**
|
|
@@ -93,6 +93,14 @@ export var Vector;
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
Vector.VectorDto = VectorDto;
|
|
96
|
+
class VectorStringDto {
|
|
97
|
+
constructor(vector) {
|
|
98
|
+
if (vector !== undefined) {
|
|
99
|
+
this.vector = vector;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
Vector.VectorStringDto = VectorStringDto;
|
|
96
104
|
class Vector3Dto {
|
|
97
105
|
constructor(vector) {
|
|
98
106
|
if (vector !== undefined) {
|
|
@@ -4,7 +4,8 @@ export declare class Color {
|
|
|
4
4
|
private readonly math;
|
|
5
5
|
constructor(math: MathBitByBit);
|
|
6
6
|
/**
|
|
7
|
-
* Creates a hex color
|
|
7
|
+
* Creates and returns a hex color string (pass-through for color input).
|
|
8
|
+
* Example: '#FF5733' → '#FF5733'
|
|
8
9
|
* @param inputs Color hex
|
|
9
10
|
* @returns color string
|
|
10
11
|
* @group create
|
|
@@ -13,7 +14,8 @@ export declare class Color {
|
|
|
13
14
|
*/
|
|
14
15
|
hexColor(inputs: Inputs.Color.HexDto): Inputs.Base.Color;
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
+
* Converts hex color to RGB object with r, g, b values (0-255 range).
|
|
18
|
+
* Example: '#FF5733' → {r: 255, g: 87, b: 51}
|
|
17
19
|
* @param inputs Color hex
|
|
18
20
|
* @returns rgb color
|
|
19
21
|
* @group convert
|
|
@@ -22,7 +24,9 @@ export declare class Color {
|
|
|
22
24
|
*/
|
|
23
25
|
hexToRgb(inputs: Inputs.Color.HexDto): Inputs.Base.ColorRGB;
|
|
24
26
|
/**
|
|
25
|
-
*
|
|
27
|
+
* Converts RGB values to hex color string (supports custom min/max ranges, auto-remaps to 0-255).
|
|
28
|
+
* Example: r=255, g=87, b=51 with range [0,255] → '#ff5733'
|
|
29
|
+
* Example: r=1, g=0.5, b=0.2 with range [0,1] → '#ff7f33'
|
|
26
30
|
* @param inputs Color hext
|
|
27
31
|
* @returns hex color
|
|
28
32
|
* @group convert
|
|
@@ -31,7 +35,8 @@ export declare class Color {
|
|
|
31
35
|
*/
|
|
32
36
|
rgbToHex(inputs: Inputs.Color.RGBMinMaxDto): Inputs.Base.Color;
|
|
33
37
|
/**
|
|
34
|
-
*
|
|
38
|
+
* Converts RGB object to hex color string (supports custom min/max ranges).
|
|
39
|
+
* Example: {r: 1, g: 0.5, b: 0.2} with range [0,1] → '#ff7f33'
|
|
35
40
|
* @param inputs Color hext
|
|
36
41
|
* @returns hex color string
|
|
37
42
|
* @group convert
|
|
@@ -40,7 +45,9 @@ export declare class Color {
|
|
|
40
45
|
*/
|
|
41
46
|
rgbObjToHex(inputs: Inputs.Color.RGBObjectMaxDto): Inputs.Base.Color;
|
|
42
47
|
/**
|
|
43
|
-
*
|
|
48
|
+
* Converts hex color to RGB and remaps values to a custom range.
|
|
49
|
+
* Example: '#FF5733' mapped to [0,1] → {r: 1, g: 0.341, b: 0.2}
|
|
50
|
+
* Example: '#FF5733' mapped to [0,100] → {r: 100, g: 34.1, b: 20}
|
|
44
51
|
* @param inputs Color hext
|
|
45
52
|
* @returns rgb color
|
|
46
53
|
* @group convert
|
|
@@ -49,7 +56,8 @@ export declare class Color {
|
|
|
49
56
|
*/
|
|
50
57
|
hexToRgbMapped(inputs: Inputs.Color.HexDtoMapped): Inputs.Base.ColorRGB;
|
|
51
58
|
/**
|
|
52
|
-
*
|
|
59
|
+
* Extracts the red channel value from hex color (can be mapped to custom range).
|
|
60
|
+
* Example: '#FF5733' with range [0,1] → 1
|
|
53
61
|
* @param inputs Color hext
|
|
54
62
|
* @returns rgb color
|
|
55
63
|
* @group hex to
|
|
@@ -58,7 +66,8 @@ export declare class Color {
|
|
|
58
66
|
*/
|
|
59
67
|
getRedParam(inputs: Inputs.Color.HexDtoMapped): number;
|
|
60
68
|
/**
|
|
61
|
-
*
|
|
69
|
+
* Extracts the green channel value from hex color (can be mapped to custom range).
|
|
70
|
+
* Example: '#FF5733' with range [0,1] → 0.341
|
|
62
71
|
* @param inputs Color hext
|
|
63
72
|
* @returns rgb color
|
|
64
73
|
* @group hex to
|
|
@@ -67,7 +76,8 @@ export declare class Color {
|
|
|
67
76
|
*/
|
|
68
77
|
getGreenParam(inputs: Inputs.Color.HexDtoMapped): number;
|
|
69
78
|
/**
|
|
70
|
-
*
|
|
79
|
+
* Extracts the blue channel value from hex color (can be mapped to custom range).
|
|
80
|
+
* Example: '#FF5733' with range [0,1] → 0.2
|
|
71
81
|
* @param inputs Color hext
|
|
72
82
|
* @returns blue param
|
|
73
83
|
* @group hex to
|
|
@@ -76,7 +86,8 @@ export declare class Color {
|
|
|
76
86
|
*/
|
|
77
87
|
getBlueParam(inputs: Inputs.Color.HexDtoMapped): number;
|
|
78
88
|
/**
|
|
79
|
-
*
|
|
89
|
+
* Extracts the red channel value from RGB object.
|
|
90
|
+
* Example: {r: 255, g: 87, b: 51} → 255
|
|
80
91
|
* @param inputs Color rgb
|
|
81
92
|
* @returns red param
|
|
82
93
|
* @group rgb to
|
|
@@ -85,7 +96,8 @@ export declare class Color {
|
|
|
85
96
|
*/
|
|
86
97
|
rgbToRed(inputs: Inputs.Color.RGBObjectDto): number;
|
|
87
98
|
/**
|
|
88
|
-
*
|
|
99
|
+
* Extracts the green channel value from RGB object.
|
|
100
|
+
* Example: {r: 255, g: 87, b: 51} → 87
|
|
89
101
|
* @param inputs Color rgb
|
|
90
102
|
* @returns green param
|
|
91
103
|
* @group rgb to
|
|
@@ -94,7 +106,8 @@ export declare class Color {
|
|
|
94
106
|
*/
|
|
95
107
|
rgbToGreen(inputs: Inputs.Color.RGBObjectDto): number;
|
|
96
108
|
/**
|
|
97
|
-
*
|
|
109
|
+
* Extracts the blue channel value from RGB object.
|
|
110
|
+
* Example: {r: 255, g: 87, b: 51} → 51
|
|
98
111
|
* @param inputs Color rgb
|
|
99
112
|
* @returns blue param
|
|
100
113
|
* @group rgb to
|
|
@@ -103,7 +116,9 @@ export declare class Color {
|
|
|
103
116
|
*/
|
|
104
117
|
rgbToBlue(inputs: Inputs.Color.RGBObjectDto): number;
|
|
105
118
|
/**
|
|
106
|
-
*
|
|
119
|
+
* Inverts a hex color (flips RGB channels: 255-r, 255-g, 255-b).
|
|
120
|
+
* With blackAndWhite=true → returns '#000000' or '#ffffff' based on brightness.
|
|
121
|
+
* Example: '#FF5733' → '#00a8cc', '#FF5733' with blackAndWhite=true → '#ffffff'
|
|
107
122
|
* @param inputs hex color and black and white option
|
|
108
123
|
* @returns inverted color
|
|
109
124
|
* @group hex to
|
|
@@ -3,7 +3,8 @@ export class Color {
|
|
|
3
3
|
this.math = math;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
* Creates a hex color
|
|
6
|
+
* Creates and returns a hex color string (pass-through for color input).
|
|
7
|
+
* Example: '#FF5733' → '#FF5733'
|
|
7
8
|
* @param inputs Color hex
|
|
8
9
|
* @returns color string
|
|
9
10
|
* @group create
|
|
@@ -14,7 +15,8 @@ export class Color {
|
|
|
14
15
|
return inputs.color;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* Converts hex color to RGB object with r, g, b values (0-255 range).
|
|
19
|
+
* Example: '#FF5733' → {r: 255, g: 87, b: 51}
|
|
18
20
|
* @param inputs Color hex
|
|
19
21
|
* @returns rgb color
|
|
20
22
|
* @group convert
|
|
@@ -30,7 +32,9 @@ export class Color {
|
|
|
30
32
|
} : undefined;
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
|
-
*
|
|
35
|
+
* Converts RGB values to hex color string (supports custom min/max ranges, auto-remaps to 0-255).
|
|
36
|
+
* Example: r=255, g=87, b=51 with range [0,255] → '#ff5733'
|
|
37
|
+
* Example: r=1, g=0.5, b=0.2 with range [0,1] → '#ff7f33'
|
|
34
38
|
* @param inputs Color hext
|
|
35
39
|
* @returns hex color
|
|
36
40
|
* @group convert
|
|
@@ -52,7 +56,8 @@ export class Color {
|
|
|
52
56
|
return s;
|
|
53
57
|
}
|
|
54
58
|
/**
|
|
55
|
-
*
|
|
59
|
+
* Converts RGB object to hex color string (supports custom min/max ranges).
|
|
60
|
+
* Example: {r: 1, g: 0.5, b: 0.2} with range [0,1] → '#ff7f33'
|
|
56
61
|
* @param inputs Color hext
|
|
57
62
|
* @returns hex color string
|
|
58
63
|
* @group convert
|
|
@@ -63,7 +68,9 @@ export class Color {
|
|
|
63
68
|
return this.rgbToHex({ r: inputs.rgb.r, g: inputs.rgb.g, b: inputs.rgb.b, min: inputs.min, max: inputs.max });
|
|
64
69
|
}
|
|
65
70
|
/**
|
|
66
|
-
*
|
|
71
|
+
* Converts hex color to RGB and remaps values to a custom range.
|
|
72
|
+
* Example: '#FF5733' mapped to [0,1] → {r: 1, g: 0.341, b: 0.2}
|
|
73
|
+
* Example: '#FF5733' mapped to [0,100] → {r: 100, g: 34.1, b: 20}
|
|
67
74
|
* @param inputs Color hext
|
|
68
75
|
* @returns rgb color
|
|
69
76
|
* @group convert
|
|
@@ -79,7 +86,8 @@ export class Color {
|
|
|
79
86
|
};
|
|
80
87
|
}
|
|
81
88
|
/**
|
|
82
|
-
*
|
|
89
|
+
* Extracts the red channel value from hex color (can be mapped to custom range).
|
|
90
|
+
* Example: '#FF5733' with range [0,1] → 1
|
|
83
91
|
* @param inputs Color hext
|
|
84
92
|
* @returns rgb color
|
|
85
93
|
* @group hex to
|
|
@@ -91,7 +99,8 @@ export class Color {
|
|
|
91
99
|
return rgb.r;
|
|
92
100
|
}
|
|
93
101
|
/**
|
|
94
|
-
*
|
|
102
|
+
* Extracts the green channel value from hex color (can be mapped to custom range).
|
|
103
|
+
* Example: '#FF5733' with range [0,1] → 0.341
|
|
95
104
|
* @param inputs Color hext
|
|
96
105
|
* @returns rgb color
|
|
97
106
|
* @group hex to
|
|
@@ -103,7 +112,8 @@ export class Color {
|
|
|
103
112
|
return rgb.g;
|
|
104
113
|
}
|
|
105
114
|
/**
|
|
106
|
-
*
|
|
115
|
+
* Extracts the blue channel value from hex color (can be mapped to custom range).
|
|
116
|
+
* Example: '#FF5733' with range [0,1] → 0.2
|
|
107
117
|
* @param inputs Color hext
|
|
108
118
|
* @returns blue param
|
|
109
119
|
* @group hex to
|
|
@@ -115,7 +125,8 @@ export class Color {
|
|
|
115
125
|
return rgb.b;
|
|
116
126
|
}
|
|
117
127
|
/**
|
|
118
|
-
*
|
|
128
|
+
* Extracts the red channel value from RGB object.
|
|
129
|
+
* Example: {r: 255, g: 87, b: 51} → 255
|
|
119
130
|
* @param inputs Color rgb
|
|
120
131
|
* @returns red param
|
|
121
132
|
* @group rgb to
|
|
@@ -126,7 +137,8 @@ export class Color {
|
|
|
126
137
|
return inputs.rgb.r;
|
|
127
138
|
}
|
|
128
139
|
/**
|
|
129
|
-
*
|
|
140
|
+
* Extracts the green channel value from RGB object.
|
|
141
|
+
* Example: {r: 255, g: 87, b: 51} → 87
|
|
130
142
|
* @param inputs Color rgb
|
|
131
143
|
* @returns green param
|
|
132
144
|
* @group rgb to
|
|
@@ -137,7 +149,8 @@ export class Color {
|
|
|
137
149
|
return inputs.rgb.g;
|
|
138
150
|
}
|
|
139
151
|
/**
|
|
140
|
-
*
|
|
152
|
+
* Extracts the blue channel value from RGB object.
|
|
153
|
+
* Example: {r: 255, g: 87, b: 51} → 51
|
|
141
154
|
* @param inputs Color rgb
|
|
142
155
|
* @returns blue param
|
|
143
156
|
* @group rgb to
|
|
@@ -148,7 +161,9 @@ export class Color {
|
|
|
148
161
|
return inputs.rgb.b;
|
|
149
162
|
}
|
|
150
163
|
/**
|
|
151
|
-
*
|
|
164
|
+
* Inverts a hex color (flips RGB channels: 255-r, 255-g, 255-b).
|
|
165
|
+
* With blackAndWhite=true → returns '#000000' or '#ffffff' based on brightness.
|
|
166
|
+
* Example: '#FF5733' → '#00a8cc', '#FF5733' with blackAndWhite=true → '#ffffff'
|
|
152
167
|
* @param inputs hex color and black and white option
|
|
153
168
|
* @returns inverted color
|
|
154
169
|
* @group hex to
|