@visulima/colorize 2.0.0-alpha.7 → 2.0.0-alpha.9
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/CHANGELOG.md +32 -0
- package/dist/gradient.cjs +9 -7
- package/dist/gradient.d.cts +2 -2
- package/dist/gradient.d.mts +2 -2
- package/dist/gradient.d.ts +2 -2
- package/dist/gradient.mjs +9 -7
- package/dist/index.browser.d.mts +2 -2
- package/dist/index.browser.mjs +1 -1
- package/dist/index.server.cjs +26 -16
- package/dist/index.server.d.cts +2 -2
- package/dist/index.server.d.mts +2 -2
- package/dist/index.server.d.ts +2 -2
- package/dist/index.server.mjs +1 -1
- package/dist/packem_shared/{Colorize-Ca9CXTcj.js → Colorize-BQ-Wlgs0.js} +9 -13
- package/dist/packem_shared/{Colorize-BenP3bFn.js → Colorize-q7kOM0WA.js} +26 -16
- package/dist/packem_shared/{GradientBuilder-DTnSGyYW.mjs → GradientBuilder-CkX4Imo9.mjs} +36 -39
- package/dist/packem_shared/{GradientBuilder-BXOgJeHi.cjs → GradientBuilder-DRrwebdU.cjs} +36 -39
- package/dist/packem_shared/{colorize.server-ry9FZNfG.mjs → colorize.server-DeZHO6IN.mjs} +15 -10
- package/dist/packem_shared/{colorize.server-BA3gZZXz.cjs → colorize.server-XetY_pdz.cjs} +15 -10
- package/dist/packem_shared/convertHexToRgb-51-edHxE.cjs +21 -0
- package/dist/packem_shared/convertHexToRgb-BZwJEiMZ.mjs +17 -0
- package/dist/packem_shared/{rgbToAnsi256-BdS0fomP.mjs → rgbToAnsi256-Bca58HoN.mjs} +2 -1
- package/dist/packem_shared/{rgbToAnsi256-DL8eajTz.cjs → rgbToAnsi256-C3-josZP.cjs} +2 -1
- package/dist/template/make-template.d.cts +1 -1
- package/dist/template/make-template.d.mts +1 -1
- package/dist/template/make-template.d.ts +1 -1
- package/dist/template.cjs +19 -8
- package/dist/template.d.cts +1 -1
- package/dist/template.d.mts +1 -1
- package/dist/template.d.ts +1 -1
- package/dist/template.mjs +19 -8
- package/dist/types.d.cts +3 -3
- package/dist/types.d.mts +3 -3
- package/dist/types.d.ts +3 -3
- package/dist/util/clamp.d.cts +1 -1
- package/dist/util/clamp.d.mts +1 -1
- package/dist/util/clamp.d.ts +1 -1
- package/dist/util/convert-hex-to-rgb.d.cts +1 -15
- package/dist/util/convert-hex-to-rgb.d.mts +1 -15
- package/dist/util/convert-hex-to-rgb.d.ts +1 -15
- package/dist/utils.cjs +2 -2
- package/dist/utils.mjs +2 -2
- package/package.json +2 -4
- package/dist/packem_shared/convertHexToRgb-CWdAm2kE.mjs +0 -13
- package/dist/packem_shared/convertHexToRgb-DvkHBM3-.cjs +0 -17
package/dist/util/clamp.d.mts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Clamp a number within the inclusive range specified by min and max.
|
|
10
|
-
*
|
|
10
|
+
* The ternary operator is a tick quicker than Math.min(Math.max(num, min), max).
|
|
11
11
|
*/
|
|
12
12
|
export declare const clamp: (number_: number, min: number, max: number) => number;
|
package/dist/util/clamp.d.ts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Clamp a number within the inclusive range specified by min and max.
|
|
10
|
-
*
|
|
10
|
+
* The ternary operator is a tick quicker than Math.min(Math.max(num, min), max).
|
|
11
11
|
*/
|
|
12
12
|
export declare const clamp: (number_: number, min: number, max: number) => number;
|
|
@@ -5,18 +5,4 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2023, webdiscus
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Convert hex color string to RGB values.
|
|
11
|
-
*
|
|
12
|
-
* A hexadecimal color code can be 3 or 6 digits with an optional "#" prefix.
|
|
13
|
-
*
|
|
14
|
-
* The 3 digits specifies an RGB doublet data as a fully opaque color.
|
|
15
|
-
* For example, "#123" specifies the color that is represented by "#112233".
|
|
16
|
-
*
|
|
17
|
-
* The 6 digits specifies a fully opaque color.
|
|
18
|
-
* For example, "#112233".
|
|
19
|
-
* @param {string} hex A string that contains the hexadecimal RGB color representation.
|
|
20
|
-
* @returns {[number, number, number]} The red, green, blue values in range [0, 255] .
|
|
21
|
-
*/
|
|
22
|
-
export declare const convertHexToRgb: (hex: ColorValueHex | string) => [number, number, number];
|
|
8
|
+
export declare const convertHexToRgb: (hex: string) => [number, number, number];
|
|
@@ -5,18 +5,4 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2023, webdiscus
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Convert hex color string to RGB values.
|
|
11
|
-
*
|
|
12
|
-
* A hexadecimal color code can be 3 or 6 digits with an optional "#" prefix.
|
|
13
|
-
*
|
|
14
|
-
* The 3 digits specifies an RGB doublet data as a fully opaque color.
|
|
15
|
-
* For example, "#123" specifies the color that is represented by "#112233".
|
|
16
|
-
*
|
|
17
|
-
* The 6 digits specifies a fully opaque color.
|
|
18
|
-
* For example, "#112233".
|
|
19
|
-
* @param {string} hex A string that contains the hexadecimal RGB color representation.
|
|
20
|
-
* @returns {[number, number, number]} The red, green, blue values in range [0, 255] .
|
|
21
|
-
*/
|
|
22
|
-
export declare const convertHexToRgb: (hex: ColorValueHex | string) => [number, number, number];
|
|
8
|
+
export declare const convertHexToRgb: (hex: string) => [number, number, number];
|
|
@@ -5,18 +5,4 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2023, webdiscus
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Convert hex color string to RGB values.
|
|
11
|
-
*
|
|
12
|
-
* A hexadecimal color code can be 3 or 6 digits with an optional "#" prefix.
|
|
13
|
-
*
|
|
14
|
-
* The 3 digits specifies an RGB doublet data as a fully opaque color.
|
|
15
|
-
* For example, "#123" specifies the color that is represented by "#112233".
|
|
16
|
-
*
|
|
17
|
-
* The 6 digits specifies a fully opaque color.
|
|
18
|
-
* For example, "#112233".
|
|
19
|
-
* @param {string} hex A string that contains the hexadecimal RGB color representation.
|
|
20
|
-
* @returns {[number, number, number]} The red, green, blue values in range [0, 255] .
|
|
21
|
-
*/
|
|
22
|
-
export declare const convertHexToRgb: (hex: ColorValueHex | string) => [number, number, number];
|
|
8
|
+
export declare const convertHexToRgb: (hex: string) => [number, number, number];
|
package/dist/utils.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
4
|
|
|
5
|
-
const convertHexToRgb = require('./packem_shared/convertHexToRgb-
|
|
6
|
-
const rgbToAnsi256 = require('./packem_shared/rgbToAnsi256-
|
|
5
|
+
const convertHexToRgb = require('./packem_shared/convertHexToRgb-51-edHxE.cjs');
|
|
6
|
+
const rgbToAnsi256 = require('./packem_shared/rgbToAnsi256-C3-josZP.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
package/dist/utils.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { convertHexToRgb } from './packem_shared/convertHexToRgb-
|
|
2
|
-
export { ansi256To16, rgbToAnsi16, rgbToAnsi256 } from './packem_shared/rgbToAnsi256-
|
|
1
|
+
export { convertHexToRgb } from './packem_shared/convertHexToRgb-BZwJEiMZ.mjs';
|
|
2
|
+
export { ansi256To16, rgbToAnsi16, rgbToAnsi256 } from './packem_shared/rgbToAnsi256-Bca58HoN.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/colorize",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.9",
|
|
4
4
|
"description": "Terminal and Console string styling done right.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"256",
|
|
@@ -165,10 +165,8 @@
|
|
|
165
165
|
"LICENSE.md"
|
|
166
166
|
],
|
|
167
167
|
"dependencies": {
|
|
168
|
-
"@visulima/is-ansi-color-supported": "3.0.0-alpha.
|
|
168
|
+
"@visulima/is-ansi-color-supported": "3.0.0-alpha.9"
|
|
169
169
|
},
|
|
170
|
-
"peerDependencies": {},
|
|
171
|
-
"optionalDependencies": {},
|
|
172
170
|
"engines": {
|
|
173
171
|
"node": ">=22.13 <=25.x"
|
|
174
172
|
},
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const convertHexToRgb = (hex) => {
|
|
2
|
-
let [, color] = /([a-f\d]{3,6})/i.exec(hex) ?? [];
|
|
3
|
-
const length_ = color ? color.length : 0;
|
|
4
|
-
if (length_ === 3) {
|
|
5
|
-
color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];
|
|
6
|
-
} else if (length_ !== 6) {
|
|
7
|
-
return [0, 0, 0];
|
|
8
|
-
}
|
|
9
|
-
const number_ = Number.parseInt(color, 16);
|
|
10
|
-
return [number_ >> 16 & 255, number_ >> 8 & 255, number_ & 255];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { convertHexToRgb };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
const convertHexToRgb = (hex) => {
|
|
6
|
-
let [, color] = /([a-f\d]{3,6})/i.exec(hex) ?? [];
|
|
7
|
-
const length_ = color ? color.length : 0;
|
|
8
|
-
if (length_ === 3) {
|
|
9
|
-
color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];
|
|
10
|
-
} else if (length_ !== 6) {
|
|
11
|
-
return [0, 0, 0];
|
|
12
|
-
}
|
|
13
|
-
const number_ = Number.parseInt(color, 16);
|
|
14
|
-
return [number_ >> 16 & 255, number_ >> 8 & 255, number_ & 255];
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
exports.convertHexToRgb = convertHexToRgb;
|