nhb-toolbox 2.8.3 → 2.8.4
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/colors/convert.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Hex6, Hex8, HSL, HSLA, RGB, RGBA } from './types';
|
|
1
|
+
import type { Hex, Hex6, Hex8, HSL, HSLA, RGB, RGBA } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* * Converts HSL to RGB color format.
|
|
4
4
|
*
|
|
@@ -32,7 +32,7 @@ export declare const convertHslToHex: (h: number, s: number, l: number) => Hex6;
|
|
|
32
32
|
* @param hex - A string representing the color in Hex format (e.g., `#FF0000`).
|
|
33
33
|
* @returns A string representing the color in HSL format (e.g., `hsl(0, 100%, 50%)`).
|
|
34
34
|
*/
|
|
35
|
-
export declare const convertHexToHsl: (hex: Hex6 |
|
|
35
|
+
export declare const convertHexToHsl: (hex: Hex6 | Hex) => HSL;
|
|
36
36
|
/**
|
|
37
37
|
* * Converts RGB to Hex color format.
|
|
38
38
|
*
|
|
@@ -48,7 +48,7 @@ export declare const convertRgbToHex: (r: number, g: number, b: number) => Hex6;
|
|
|
48
48
|
* @param hex - A string representing the color in Hex format (e.g., `#FF0000`).
|
|
49
49
|
* @returns A string representing the color in RGB format (e.g., `rgb(255, 0, 0)`).
|
|
50
50
|
*/
|
|
51
|
-
export declare const convertHexToRgb: (hex: Hex6 | string) => RGB;
|
|
51
|
+
export declare const convertHexToRgb: (hex: Hex6 | Hex | string) => RGB;
|
|
52
52
|
/**
|
|
53
53
|
* * Converts RGB to RGBA format, adding alpha (opacity).
|
|
54
54
|
*
|
|
@@ -91,6 +91,8 @@ export declare const convertHslaToRgba: (h: number, s: number, l: number, a?: nu
|
|
|
91
91
|
export declare const convertRgbaToHsla: (r: number, g: number, b: number, a?: number) => HSLA;
|
|
92
92
|
/**
|
|
93
93
|
* * Converts Hex8 to RGBA color format, including alpha channel.
|
|
94
|
+
* - `Special Note:` Cast the parameter to `Hex8` before converting to `RGBA`.
|
|
95
|
+
* @example convertHex8ToRgba('#FFF122DE' as Hex8)
|
|
94
96
|
*
|
|
95
97
|
* @param hex8 - A string representing the color in Hex8 format (e.g., `#FF000080`).
|
|
96
98
|
* @returns A string representing the color in RGBA format (e.g., `rgba(255, 0, 0, 0.5)`).
|
|
@@ -108,6 +110,8 @@ export declare const convertHex8ToRgba: (hex8: Hex8) => RGBA;
|
|
|
108
110
|
export declare const convertHslaToHex8: (h: number, s: number, l: number, a?: number) => Hex8;
|
|
109
111
|
/**
|
|
110
112
|
* * Converts Hex8 to HSLA color format.
|
|
113
|
+
* - `Special Note:` Cast the parameter to `Hex8` before converting to `HSLA`.
|
|
114
|
+
* @example convertHex8ToHsla('#FFF122DE' as Hex8)
|
|
111
115
|
*
|
|
112
116
|
* @param hex - A string representing the color in Hex format (e.g., `#FF0000DE`).
|
|
113
117
|
* @returns A string representing the color in HSLA format..
|
|
@@ -115,6 +119,8 @@ export declare const convertHslaToHex8: (h: number, s: number, l: number, a?: nu
|
|
|
115
119
|
export declare const convertHex8ToHsla: (hex8: Hex8) => HSLA;
|
|
116
120
|
/**
|
|
117
121
|
* * Converts a `Hex` color code to `RGB` and `HSL` formats.
|
|
122
|
+
* - `Special Note:` Cast the parameter to `Hex6` before converting to `RGB` and `HSL`.
|
|
123
|
+
* @example convertColorCode('#FFF122' as Hex6)
|
|
118
124
|
*
|
|
119
125
|
* @param color The `Hex` color code (e.g., `#3c6945`).
|
|
120
126
|
* @returns An object containing the `RGB` and `HSL` formats of the given `Hex` color.
|
|
@@ -145,6 +151,8 @@ export declare function convertColorCode(color: HSL): {
|
|
|
145
151
|
};
|
|
146
152
|
/**
|
|
147
153
|
* * Converts a `Hex8` color code to `RGB` and `HSL` formats.
|
|
154
|
+
* - `Special Note:` Cast the parameter to `Hex8` before converting to `RGBA` and `HSLA`.
|
|
155
|
+
* @example convertColorCode('#FFF122DE' as Hex8)
|
|
148
156
|
*
|
|
149
157
|
* @param color The `Hex8` color code (e.g., `#3c6945`).
|
|
150
158
|
* @returns An object containing the `RGB` and `HSL` formats of the given `Hex8` color.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/colors/convert.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAGX,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAI,EAEJ,GAAG,EACH,IAAI,EACJ,MAAM,SAAS,CAAC;AAEjB;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,GAyBjE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,GAkCjE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,IAIjE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAS,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/colors/convert.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAGX,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAI,EAEJ,GAAG,EACH,IAAI,EACJ,MAAM,SAAS,CAAC;AAEjB;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,GAyBjE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,GAkCjE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,IAIjE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAS,IAAI,GAAG,G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,CAAC,KAAK,EAAE,GAAG,GAAG;IAC7C,GAAG,EAAE,IAAI,CAAC;IACV,GAAG,EAAE,GAAG,CAAC;CACT,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,GAAG;IAC9C,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;CACX,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,GAAG;IAC9C,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;CACX,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,GAAG;IAC9C,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;CACX,CAAC"}
|
package/dist/colors/convert.js
CHANGED
|
@@ -208,6 +208,8 @@ export const convertRgbaToHsla = (r, g, b, a = 1) => {
|
|
|
208
208
|
};
|
|
209
209
|
/**
|
|
210
210
|
* * Converts Hex8 to RGBA color format, including alpha channel.
|
|
211
|
+
* - `Special Note:` Cast the parameter to `Hex8` before converting to `RGBA`.
|
|
212
|
+
* @example convertHex8ToRgba('#FFF122DE' as Hex8)
|
|
211
213
|
*
|
|
212
214
|
* @param hex8 - A string representing the color in Hex8 format (e.g., `#FF000080`).
|
|
213
215
|
* @returns A string representing the color in RGBA format (e.g., `rgba(255, 0, 0, 0.5)`).
|
|
@@ -241,6 +243,8 @@ export const convertHslaToHex8 = (h, s, l, a = 1) => {
|
|
|
241
243
|
};
|
|
242
244
|
/**
|
|
243
245
|
* * Converts Hex8 to HSLA color format.
|
|
246
|
+
* - `Special Note:` Cast the parameter to `Hex8` before converting to `HSLA`.
|
|
247
|
+
* @example convertHex8ToHsla('#FFF122DE' as Hex8)
|
|
244
248
|
*
|
|
245
249
|
* @param hex - A string representing the color in Hex format (e.g., `#FF0000DE`).
|
|
246
250
|
* @returns A string representing the color in HSLA format..
|
package/package.json
CHANGED