es-toolkit 1.46.1-dev.1804 → 1.46.1-dev.1806
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/browser.global.js +3 -3
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -1
- package/dist/object/index.d.mts +2 -1
- package/dist/object/index.d.ts +2 -1
- package/dist/object/index.js +2 -0
- package/dist/object/index.mjs +2 -1
- package/dist/object/sortKeys.d.mts +22 -0
- package/dist/object/sortKeys.d.ts +22 -0
- package/dist/object/sortKeys.js +30 -0
- package/dist/object/sortKeys.mjs +30 -0
- package/dist/server/colors/_internal/parseHex.js +32 -0
- package/dist/server/colors/_internal/parseHex.mjs +32 -0
- package/dist/server/colors/_internal/wrapAnsi.js +21 -0
- package/dist/server/colors/_internal/wrapAnsi.mjs +21 -0
- package/dist/server/colors/_internal/wrapAnsiBg.js +30 -0
- package/dist/server/colors/_internal/wrapAnsiBg.mjs +30 -0
- package/dist/server/colors/ansi256.d.mts +18 -0
- package/dist/server/colors/ansi256.d.ts +18 -0
- package/dist/server/colors/ansi256.js +19 -0
- package/dist/server/colors/ansi256.mjs +19 -0
- package/dist/server/colors/bgAnsi256.d.mts +18 -0
- package/dist/server/colors/bgAnsi256.d.ts +18 -0
- package/dist/server/colors/bgAnsi256.js +19 -0
- package/dist/server/colors/bgAnsi256.mjs +19 -0
- package/dist/server/colors/bgBlack.d.mts +15 -0
- package/dist/server/colors/bgBlack.d.ts +15 -0
- package/dist/server/colors/bgBlack.js +18 -0
- package/dist/server/colors/bgBlack.mjs +18 -0
- package/dist/server/colors/bgBlackBright.d.mts +15 -0
- package/dist/server/colors/bgBlackBright.d.ts +15 -0
- package/dist/server/colors/bgBlackBright.js +18 -0
- package/dist/server/colors/bgBlackBright.mjs +18 -0
- package/dist/server/colors/bgBlue.d.mts +15 -0
- package/dist/server/colors/bgBlue.d.ts +15 -0
- package/dist/server/colors/bgBlue.js +18 -0
- package/dist/server/colors/bgBlue.mjs +18 -0
- package/dist/server/colors/bgBlueBright.d.mts +15 -0
- package/dist/server/colors/bgBlueBright.d.ts +15 -0
- package/dist/server/colors/bgBlueBright.js +18 -0
- package/dist/server/colors/bgBlueBright.mjs +18 -0
- package/dist/server/colors/bgCyan.d.mts +15 -0
- package/dist/server/colors/bgCyan.d.ts +15 -0
- package/dist/server/colors/bgCyan.js +18 -0
- package/dist/server/colors/bgCyan.mjs +18 -0
- package/dist/server/colors/bgCyanBright.d.mts +15 -0
- package/dist/server/colors/bgCyanBright.d.ts +15 -0
- package/dist/server/colors/bgCyanBright.js +18 -0
- package/dist/server/colors/bgCyanBright.mjs +18 -0
- package/dist/server/colors/bgGreen.d.mts +15 -0
- package/dist/server/colors/bgGreen.d.ts +15 -0
- package/dist/server/colors/bgGreen.js +18 -0
- package/dist/server/colors/bgGreen.mjs +18 -0
- package/dist/server/colors/bgGreenBright.d.mts +15 -0
- package/dist/server/colors/bgGreenBright.d.ts +15 -0
- package/dist/server/colors/bgGreenBright.js +18 -0
- package/dist/server/colors/bgGreenBright.mjs +18 -0
- package/dist/server/colors/bgHex.d.mts +18 -0
- package/dist/server/colors/bgHex.d.ts +18 -0
- package/dist/server/colors/bgHex.js +21 -0
- package/dist/server/colors/bgHex.mjs +21 -0
- package/dist/server/colors/bgMagenta.d.mts +15 -0
- package/dist/server/colors/bgMagenta.d.ts +15 -0
- package/dist/server/colors/bgMagenta.js +18 -0
- package/dist/server/colors/bgMagenta.mjs +18 -0
- package/dist/server/colors/bgMagentaBright.d.mts +15 -0
- package/dist/server/colors/bgMagentaBright.d.ts +15 -0
- package/dist/server/colors/bgMagentaBright.js +18 -0
- package/dist/server/colors/bgMagentaBright.mjs +18 -0
- package/dist/server/colors/bgRed.d.mts +15 -0
- package/dist/server/colors/bgRed.d.ts +15 -0
- package/dist/server/colors/bgRed.js +18 -0
- package/dist/server/colors/bgRed.mjs +18 -0
- package/dist/server/colors/bgRedBright.d.mts +15 -0
- package/dist/server/colors/bgRedBright.d.ts +15 -0
- package/dist/server/colors/bgRedBright.js +18 -0
- package/dist/server/colors/bgRedBright.mjs +18 -0
- package/dist/server/colors/bgRgb.d.mts +20 -0
- package/dist/server/colors/bgRgb.d.ts +20 -0
- package/dist/server/colors/bgRgb.js +21 -0
- package/dist/server/colors/bgRgb.mjs +21 -0
- package/dist/server/colors/bgWhite.d.mts +15 -0
- package/dist/server/colors/bgWhite.d.ts +15 -0
- package/dist/server/colors/bgWhite.js +18 -0
- package/dist/server/colors/bgWhite.mjs +18 -0
- package/dist/server/colors/bgWhiteBright.d.mts +15 -0
- package/dist/server/colors/bgWhiteBright.d.ts +15 -0
- package/dist/server/colors/bgWhiteBright.js +18 -0
- package/dist/server/colors/bgWhiteBright.mjs +18 -0
- package/dist/server/colors/bgYellow.d.mts +15 -0
- package/dist/server/colors/bgYellow.d.ts +15 -0
- package/dist/server/colors/bgYellow.js +18 -0
- package/dist/server/colors/bgYellow.mjs +18 -0
- package/dist/server/colors/bgYellowBright.d.mts +15 -0
- package/dist/server/colors/bgYellowBright.d.ts +15 -0
- package/dist/server/colors/bgYellowBright.js +18 -0
- package/dist/server/colors/bgYellowBright.mjs +18 -0
- package/dist/server/colors/black.d.mts +15 -0
- package/dist/server/colors/black.d.ts +15 -0
- package/dist/server/colors/black.js +18 -0
- package/dist/server/colors/black.mjs +18 -0
- package/dist/server/colors/blackBright.d.mts +15 -0
- package/dist/server/colors/blackBright.d.ts +15 -0
- package/dist/server/colors/blackBright.js +18 -0
- package/dist/server/colors/blackBright.mjs +18 -0
- package/dist/server/colors/blue.d.mts +15 -0
- package/dist/server/colors/blue.d.ts +15 -0
- package/dist/server/colors/blue.js +18 -0
- package/dist/server/colors/blue.mjs +18 -0
- package/dist/server/colors/blueBright.d.mts +15 -0
- package/dist/server/colors/blueBright.d.ts +15 -0
- package/dist/server/colors/blueBright.js +18 -0
- package/dist/server/colors/blueBright.mjs +18 -0
- package/dist/server/colors/bold.d.mts +15 -0
- package/dist/server/colors/bold.d.ts +15 -0
- package/dist/server/colors/bold.js +18 -0
- package/dist/server/colors/bold.mjs +18 -0
- package/dist/server/colors/cyan.d.mts +15 -0
- package/dist/server/colors/cyan.d.ts +15 -0
- package/dist/server/colors/cyan.js +18 -0
- package/dist/server/colors/cyan.mjs +18 -0
- package/dist/server/colors/cyanBright.d.mts +15 -0
- package/dist/server/colors/cyanBright.d.ts +15 -0
- package/dist/server/colors/cyanBright.js +18 -0
- package/dist/server/colors/cyanBright.mjs +18 -0
- package/dist/server/colors/dim.d.mts +15 -0
- package/dist/server/colors/dim.d.ts +15 -0
- package/dist/server/colors/dim.js +18 -0
- package/dist/server/colors/dim.mjs +18 -0
- package/dist/server/colors/gray.js +18 -0
- package/dist/server/colors/gray.mjs +19 -0
- package/dist/server/colors/green.d.mts +15 -0
- package/dist/server/colors/green.d.ts +15 -0
- package/dist/server/colors/green.js +18 -0
- package/dist/server/colors/green.mjs +18 -0
- package/dist/server/colors/greenBright.d.mts +15 -0
- package/dist/server/colors/greenBright.d.ts +15 -0
- package/dist/server/colors/greenBright.js +18 -0
- package/dist/server/colors/greenBright.mjs +18 -0
- package/dist/server/colors/hex.d.mts +18 -0
- package/dist/server/colors/hex.d.ts +18 -0
- package/dist/server/colors/hex.js +21 -0
- package/dist/server/colors/hex.mjs +21 -0
- package/dist/server/colors/hidden.d.mts +15 -0
- package/dist/server/colors/hidden.d.ts +15 -0
- package/dist/server/colors/hidden.js +18 -0
- package/dist/server/colors/hidden.mjs +18 -0
- package/dist/server/colors/index.d.mts +99 -0
- package/dist/server/colors/index.d.ts +99 -0
- package/dist/server/colors/index.js +99 -0
- package/dist/server/colors/index.mjs +99 -0
- package/dist/server/colors/inverse.d.mts +15 -0
- package/dist/server/colors/inverse.d.ts +15 -0
- package/dist/server/colors/inverse.js +18 -0
- package/dist/server/colors/inverse.mjs +18 -0
- package/dist/server/colors/italic.d.mts +15 -0
- package/dist/server/colors/italic.d.ts +15 -0
- package/dist/server/colors/italic.js +18 -0
- package/dist/server/colors/italic.mjs +18 -0
- package/dist/server/colors/magenta.d.mts +15 -0
- package/dist/server/colors/magenta.d.ts +15 -0
- package/dist/server/colors/magenta.js +18 -0
- package/dist/server/colors/magenta.mjs +18 -0
- package/dist/server/colors/magentaBright.d.mts +15 -0
- package/dist/server/colors/magentaBright.d.ts +15 -0
- package/dist/server/colors/magentaBright.js +18 -0
- package/dist/server/colors/magentaBright.mjs +18 -0
- package/dist/server/colors/red.d.mts +15 -0
- package/dist/server/colors/red.d.ts +15 -0
- package/dist/server/colors/red.js +18 -0
- package/dist/server/colors/red.mjs +18 -0
- package/dist/server/colors/redBright.d.mts +15 -0
- package/dist/server/colors/redBright.d.ts +15 -0
- package/dist/server/colors/redBright.js +18 -0
- package/dist/server/colors/redBright.mjs +18 -0
- package/dist/server/colors/reset.d.mts +15 -0
- package/dist/server/colors/reset.d.ts +15 -0
- package/dist/server/colors/reset.js +18 -0
- package/dist/server/colors/reset.mjs +18 -0
- package/dist/server/colors/rgb.d.mts +20 -0
- package/dist/server/colors/rgb.d.ts +20 -0
- package/dist/server/colors/rgb.js +21 -0
- package/dist/server/colors/rgb.mjs +21 -0
- package/dist/server/colors/strikethrough.d.mts +15 -0
- package/dist/server/colors/strikethrough.d.ts +15 -0
- package/dist/server/colors/strikethrough.js +18 -0
- package/dist/server/colors/strikethrough.mjs +18 -0
- package/dist/server/colors/types.d.mts +4 -0
- package/dist/server/colors/types.d.ts +4 -0
- package/dist/server/colors/underline.d.mts +15 -0
- package/dist/server/colors/underline.d.ts +15 -0
- package/dist/server/colors/underline.js +18 -0
- package/dist/server/colors/underline.mjs +18 -0
- package/dist/server/colors/white.d.mts +15 -0
- package/dist/server/colors/white.d.ts +15 -0
- package/dist/server/colors/white.js +18 -0
- package/dist/server/colors/white.mjs +18 -0
- package/dist/server/colors/whiteBright.d.mts +15 -0
- package/dist/server/colors/whiteBright.d.ts +15 -0
- package/dist/server/colors/whiteBright.js +18 -0
- package/dist/server/colors/whiteBright.mjs +18 -0
- package/dist/server/colors/yellow.d.mts +15 -0
- package/dist/server/colors/yellow.d.ts +15 -0
- package/dist/server/colors/yellow.js +18 -0
- package/dist/server/colors/yellow.mjs +18 -0
- package/dist/server/colors/yellowBright.d.mts +15 -0
- package/dist/server/colors/yellowBright.d.ts +15 -0
- package/dist/server/colors/yellowBright.js +18 -0
- package/dist/server/colors/yellowBright.mjs +18 -0
- package/dist/server/index.d.mts +3 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +3 -0
- package/dist/server/index.mjs +2 -0
- package/package.json +22 -1
- package/server.d.ts +1 -0
- package/server.js +1 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/object/sortKeys.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new object with the keys sorted.
|
|
4
|
+
*
|
|
5
|
+
* The keys are sorted alphabetically by default, but a custom compare function can be provided.
|
|
6
|
+
*
|
|
7
|
+
* @template T - The type of the object.
|
|
8
|
+
* @param {T} object - The object to sort keys from.
|
|
9
|
+
* @param {(a: string, b: string) => number} [compareKeys] - A custom compare function for sorting keys.
|
|
10
|
+
* @returns {T} A new object with the keys sorted.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* sortKeys({ b: 2, a: 1, c: 3 });
|
|
14
|
+
* // => { a: 1, b: 2, c: 3 }
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* sortKeys({ b: 2, a: 1, c: 3 }, (a, b) => b.localeCompare(a));
|
|
18
|
+
* // => { c: 3, b: 2, a: 1 }
|
|
19
|
+
*/
|
|
20
|
+
function sortKeys(object, compareKeys) {
|
|
21
|
+
const sortedKeys = Object.keys(object).sort(compareKeys);
|
|
22
|
+
const result = {};
|
|
23
|
+
for (let i = 0; i < sortedKeys.length; i++) {
|
|
24
|
+
const key = sortedKeys[i];
|
|
25
|
+
result[key] = object[key];
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.sortKeys = sortKeys;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/object/sortKeys.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new object with the keys sorted.
|
|
4
|
+
*
|
|
5
|
+
* The keys are sorted alphabetically by default, but a custom compare function can be provided.
|
|
6
|
+
*
|
|
7
|
+
* @template T - The type of the object.
|
|
8
|
+
* @param {T} object - The object to sort keys from.
|
|
9
|
+
* @param {(a: string, b: string) => number} [compareKeys] - A custom compare function for sorting keys.
|
|
10
|
+
* @returns {T} A new object with the keys sorted.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* sortKeys({ b: 2, a: 1, c: 3 });
|
|
14
|
+
* // => { a: 1, b: 2, c: 3 }
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* sortKeys({ b: 2, a: 1, c: 3 }, (a, b) => b.localeCompare(a));
|
|
18
|
+
* // => { c: 3, b: 2, a: 1 }
|
|
19
|
+
*/
|
|
20
|
+
function sortKeys(object, compareKeys) {
|
|
21
|
+
const sortedKeys = Object.keys(object).sort(compareKeys);
|
|
22
|
+
const result = {};
|
|
23
|
+
for (let i = 0; i < sortedKeys.length; i++) {
|
|
24
|
+
const key = sortedKeys[i];
|
|
25
|
+
result[key] = object[key];
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { sortKeys };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/server/colors/_internal/parseHex.ts
|
|
2
|
+
const BLACK = [
|
|
3
|
+
0,
|
|
4
|
+
0,
|
|
5
|
+
0
|
|
6
|
+
];
|
|
7
|
+
const HEX_COLOR_REGEX = /^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$/;
|
|
8
|
+
/**
|
|
9
|
+
* Parses a hex color string (e.g. "#ff0000", "#f00", "ff0000") into
|
|
10
|
+
* an [r, g, b] tuple. Used by `hex()` and `bgHex()` to convert
|
|
11
|
+
* user-provided hex values into RGB components for ANSI escape codes.
|
|
12
|
+
*
|
|
13
|
+
* Only #RGB and #RRGGBB formats are supported. #RGBA and #RRGGBBAA
|
|
14
|
+
* are not accepted because ANSI terminals do not support alpha channels.
|
|
15
|
+
* Returns [0, 0, 0] (black) for invalid input.
|
|
16
|
+
*
|
|
17
|
+
* @param hex - A hex color string, with or without the leading `#`.
|
|
18
|
+
* @returns An `[r, g, b]` tuple with each component in the 0–255 range.
|
|
19
|
+
*/
|
|
20
|
+
function parseHex(hex) {
|
|
21
|
+
const raw = hex.startsWith("#") ? hex.slice(1) : hex;
|
|
22
|
+
if (!HEX_COLOR_REGEX.test(raw)) return BLACK;
|
|
23
|
+
const full = raw.length === 3 ? raw[0] + raw[0] + raw[1] + raw[1] + raw[2] + raw[2] : raw;
|
|
24
|
+
const colorValue = parseInt(full, 16);
|
|
25
|
+
return [
|
|
26
|
+
colorValue >> 16 & 255,
|
|
27
|
+
colorValue >> 8 & 255,
|
|
28
|
+
colorValue & 255
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.parseHex = parseHex;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/server/colors/_internal/parseHex.ts
|
|
2
|
+
const BLACK = [
|
|
3
|
+
0,
|
|
4
|
+
0,
|
|
5
|
+
0
|
|
6
|
+
];
|
|
7
|
+
const HEX_COLOR_REGEX = /^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$/;
|
|
8
|
+
/**
|
|
9
|
+
* Parses a hex color string (e.g. "#ff0000", "#f00", "ff0000") into
|
|
10
|
+
* an [r, g, b] tuple. Used by `hex()` and `bgHex()` to convert
|
|
11
|
+
* user-provided hex values into RGB components for ANSI escape codes.
|
|
12
|
+
*
|
|
13
|
+
* Only #RGB and #RRGGBB formats are supported. #RGBA and #RRGGBBAA
|
|
14
|
+
* are not accepted because ANSI terminals do not support alpha channels.
|
|
15
|
+
* Returns [0, 0, 0] (black) for invalid input.
|
|
16
|
+
*
|
|
17
|
+
* @param hex - A hex color string, with or without the leading `#`.
|
|
18
|
+
* @returns An `[r, g, b]` tuple with each component in the 0–255 range.
|
|
19
|
+
*/
|
|
20
|
+
function parseHex(hex) {
|
|
21
|
+
const raw = hex.startsWith("#") ? hex.slice(1) : hex;
|
|
22
|
+
if (!HEX_COLOR_REGEX.test(raw)) return BLACK;
|
|
23
|
+
const full = raw.length === 3 ? raw[0] + raw[0] + raw[1] + raw[1] + raw[2] + raw[2] : raw;
|
|
24
|
+
const colorValue = parseInt(full, 16);
|
|
25
|
+
return [
|
|
26
|
+
colorValue >> 16 & 255,
|
|
27
|
+
colorValue >> 8 & 255,
|
|
28
|
+
colorValue & 255
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { parseHex };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/server/colors/_internal/wrapAnsi.ts
|
|
2
|
+
/**
|
|
3
|
+
* Wraps text with ANSI open/close codes for foreground colors and modifiers.
|
|
4
|
+
*
|
|
5
|
+
* If `text` already contains `close` (typically from a nested style that
|
|
6
|
+
* shares the same close code, e.g. `red(green('x'))` where both end with
|
|
7
|
+
* `\x1b[39m`), re-opens the outer style after each occurrence so the rest
|
|
8
|
+
* of the text keeps its color. For background colors use `wrapAnsiBg`
|
|
9
|
+
* instead — it adds the newline handling that backgrounds need.
|
|
10
|
+
*
|
|
11
|
+
* @param open - The ANSI open code (e.g. `\x1b[31m`).
|
|
12
|
+
* @param close - The ANSI close code (e.g. `\x1b[39m`).
|
|
13
|
+
* @param text - The text to wrap.
|
|
14
|
+
* @returns The wrapped text.
|
|
15
|
+
*/
|
|
16
|
+
function wrapAnsi(open, close, text) {
|
|
17
|
+
if (text.includes(close)) text = text.replaceAll(close, close + open);
|
|
18
|
+
return open + text + close;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.wrapAnsi = wrapAnsi;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/server/colors/_internal/wrapAnsi.ts
|
|
2
|
+
/**
|
|
3
|
+
* Wraps text with ANSI open/close codes for foreground colors and modifiers.
|
|
4
|
+
*
|
|
5
|
+
* If `text` already contains `close` (typically from a nested style that
|
|
6
|
+
* shares the same close code, e.g. `red(green('x'))` where both end with
|
|
7
|
+
* `\x1b[39m`), re-opens the outer style after each occurrence so the rest
|
|
8
|
+
* of the text keeps its color. For background colors use `wrapAnsiBg`
|
|
9
|
+
* instead — it adds the newline handling that backgrounds need.
|
|
10
|
+
*
|
|
11
|
+
* @param open - The ANSI open code (e.g. `\x1b[31m`).
|
|
12
|
+
* @param close - The ANSI close code (e.g. `\x1b[39m`).
|
|
13
|
+
* @param text - The text to wrap.
|
|
14
|
+
* @returns The wrapped text.
|
|
15
|
+
*/
|
|
16
|
+
function wrapAnsi(open, close, text) {
|
|
17
|
+
if (text.includes(close)) text = text.replaceAll(close, close + open);
|
|
18
|
+
return open + text + close;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { wrapAnsi };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/server/colors/_internal/wrapAnsiBg.ts
|
|
2
|
+
/**
|
|
3
|
+
* Wraps text with ANSI open/close codes for background colors.
|
|
4
|
+
*
|
|
5
|
+
* On top of the basic wrap, handles two cases:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Nested style sharing the same close.** If `text` already contains
|
|
8
|
+
* `close` (e.g. `bgRed(bgGreen('x'))` where both end with `\x1b[49m`),
|
|
9
|
+
* re-opens the outer style after each occurrence so the rest keeps its
|
|
10
|
+
* color. This step runs first.
|
|
11
|
+
* 2. **Multi-line text.** Terminals reset the background color at line
|
|
12
|
+
* boundaries, so the bg disappears after `\n` if not re-opened. Insert
|
|
13
|
+
* `close + open` around every newline. CRLF is treated as a single unit
|
|
14
|
+
* so the close sits outside both characters.
|
|
15
|
+
*
|
|
16
|
+
* Step 2 must run after step 1 — otherwise the close codes that step 2
|
|
17
|
+
* inserts would also trigger step 1's re-open and leak duplicate codes.
|
|
18
|
+
*
|
|
19
|
+
* @param open - The ANSI background open code (e.g. `\x1b[41m`).
|
|
20
|
+
* @param close - The ANSI background close code (e.g. `\x1b[49m`).
|
|
21
|
+
* @param text - The text to wrap.
|
|
22
|
+
* @returns The wrapped text.
|
|
23
|
+
*/
|
|
24
|
+
function wrapAnsiBg(open, close, text) {
|
|
25
|
+
if (text.includes(close)) text = text.replaceAll(close, close + open);
|
|
26
|
+
if (text.includes("\n")) text = text.replaceAll(/\r?\n/g, (match) => close + match + open);
|
|
27
|
+
return open + text + close;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.wrapAnsiBg = wrapAnsiBg;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/server/colors/_internal/wrapAnsiBg.ts
|
|
2
|
+
/**
|
|
3
|
+
* Wraps text with ANSI open/close codes for background colors.
|
|
4
|
+
*
|
|
5
|
+
* On top of the basic wrap, handles two cases:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Nested style sharing the same close.** If `text` already contains
|
|
8
|
+
* `close` (e.g. `bgRed(bgGreen('x'))` where both end with `\x1b[49m`),
|
|
9
|
+
* re-opens the outer style after each occurrence so the rest keeps its
|
|
10
|
+
* color. This step runs first.
|
|
11
|
+
* 2. **Multi-line text.** Terminals reset the background color at line
|
|
12
|
+
* boundaries, so the bg disappears after `\n` if not re-opened. Insert
|
|
13
|
+
* `close + open` around every newline. CRLF is treated as a single unit
|
|
14
|
+
* so the close sits outside both characters.
|
|
15
|
+
*
|
|
16
|
+
* Step 2 must run after step 1 — otherwise the close codes that step 2
|
|
17
|
+
* inserts would also trigger step 1's re-open and leak duplicate codes.
|
|
18
|
+
*
|
|
19
|
+
* @param open - The ANSI background open code (e.g. `\x1b[41m`).
|
|
20
|
+
* @param close - The ANSI background close code (e.g. `\x1b[49m`).
|
|
21
|
+
* @param text - The text to wrap.
|
|
22
|
+
* @returns The wrapped text.
|
|
23
|
+
*/
|
|
24
|
+
function wrapAnsiBg(open, close, text) {
|
|
25
|
+
if (text.includes(close)) text = text.replaceAll(close, close + open);
|
|
26
|
+
if (text.includes("\n")) text = text.replaceAll(/\r?\n/g, (match) => close + match + open);
|
|
27
|
+
return open + text + close;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { wrapAnsiBg };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ColorFunction } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/server/colors/ansi256.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns a function that wraps text with the given 8-bit (256-color) foreground.
|
|
6
|
+
*
|
|
7
|
+
* @param code - The 8-bit color code (0–255).
|
|
8
|
+
* @returns A color function that wraps text with the chosen ANSI 256 foreground.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { colors } from 'es-toolkit/server';
|
|
12
|
+
*
|
|
13
|
+
* const orange = colors.ansi256(208);
|
|
14
|
+
* console.log(orange('hello'));
|
|
15
|
+
*/
|
|
16
|
+
declare function ansi256(code: number): ColorFunction;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { ansi256 };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ColorFunction } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/server/colors/ansi256.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns a function that wraps text with the given 8-bit (256-color) foreground.
|
|
6
|
+
*
|
|
7
|
+
* @param code - The 8-bit color code (0–255).
|
|
8
|
+
* @returns A color function that wraps text with the chosen ANSI 256 foreground.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { colors } from 'es-toolkit/server';
|
|
12
|
+
*
|
|
13
|
+
* const orange = colors.ansi256(208);
|
|
14
|
+
* console.log(orange('hello'));
|
|
15
|
+
*/
|
|
16
|
+
declare function ansi256(code: number): ColorFunction;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { ansi256 };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_wrapAnsi = require("./_internal/wrapAnsi.js");
|
|
2
|
+
//#region src/server/colors/ansi256.ts
|
|
3
|
+
/**
|
|
4
|
+
* Returns a function that wraps text with the given 8-bit (256-color) foreground.
|
|
5
|
+
*
|
|
6
|
+
* @param code - The 8-bit color code (0–255).
|
|
7
|
+
* @returns A color function that wraps text with the chosen ANSI 256 foreground.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* const orange = colors.ansi256(208);
|
|
13
|
+
* console.log(orange('hello'));
|
|
14
|
+
*/
|
|
15
|
+
function ansi256(code) {
|
|
16
|
+
return (text) => require_wrapAnsi.wrapAnsi(`\x1b[38;5;${code}m`, "\x1B[39m", text);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.ansi256 = ansi256;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { wrapAnsi } from "./_internal/wrapAnsi.mjs";
|
|
2
|
+
//#region src/server/colors/ansi256.ts
|
|
3
|
+
/**
|
|
4
|
+
* Returns a function that wraps text with the given 8-bit (256-color) foreground.
|
|
5
|
+
*
|
|
6
|
+
* @param code - The 8-bit color code (0–255).
|
|
7
|
+
* @returns A color function that wraps text with the chosen ANSI 256 foreground.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* const orange = colors.ansi256(208);
|
|
13
|
+
* console.log(orange('hello'));
|
|
14
|
+
*/
|
|
15
|
+
function ansi256(code) {
|
|
16
|
+
return (text) => wrapAnsi(`\x1b[38;5;${code}m`, "\x1B[39m", text);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { ansi256 };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ColorFunction } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/server/colors/bgAnsi256.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns a function that wraps text with the given 8-bit (256-color) background.
|
|
6
|
+
*
|
|
7
|
+
* @param code - The 8-bit color code (0–255).
|
|
8
|
+
* @returns A color function that wraps text with the chosen ANSI 256 background.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { colors } from 'es-toolkit/server';
|
|
12
|
+
*
|
|
13
|
+
* const warn = colors.bgAnsi256(208);
|
|
14
|
+
* console.log(warn('hello'));
|
|
15
|
+
*/
|
|
16
|
+
declare function bgAnsi256(code: number): ColorFunction;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { bgAnsi256 };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ColorFunction } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/server/colors/bgAnsi256.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns a function that wraps text with the given 8-bit (256-color) background.
|
|
6
|
+
*
|
|
7
|
+
* @param code - The 8-bit color code (0–255).
|
|
8
|
+
* @returns A color function that wraps text with the chosen ANSI 256 background.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { colors } from 'es-toolkit/server';
|
|
12
|
+
*
|
|
13
|
+
* const warn = colors.bgAnsi256(208);
|
|
14
|
+
* console.log(warn('hello'));
|
|
15
|
+
*/
|
|
16
|
+
declare function bgAnsi256(code: number): ColorFunction;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { bgAnsi256 };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_wrapAnsiBg = require("./_internal/wrapAnsiBg.js");
|
|
2
|
+
//#region src/server/colors/bgAnsi256.ts
|
|
3
|
+
/**
|
|
4
|
+
* Returns a function that wraps text with the given 8-bit (256-color) background.
|
|
5
|
+
*
|
|
6
|
+
* @param code - The 8-bit color code (0–255).
|
|
7
|
+
* @returns A color function that wraps text with the chosen ANSI 256 background.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* const warn = colors.bgAnsi256(208);
|
|
13
|
+
* console.log(warn('hello'));
|
|
14
|
+
*/
|
|
15
|
+
function bgAnsi256(code) {
|
|
16
|
+
return (text) => require_wrapAnsiBg.wrapAnsiBg(`\x1b[48;5;${code}m`, "\x1B[49m", text);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.bgAnsi256 = bgAnsi256;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { wrapAnsiBg } from "./_internal/wrapAnsiBg.mjs";
|
|
2
|
+
//#region src/server/colors/bgAnsi256.ts
|
|
3
|
+
/**
|
|
4
|
+
* Returns a function that wraps text with the given 8-bit (256-color) background.
|
|
5
|
+
*
|
|
6
|
+
* @param code - The 8-bit color code (0–255).
|
|
7
|
+
* @returns A color function that wraps text with the chosen ANSI 256 background.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* const warn = colors.bgAnsi256(208);
|
|
13
|
+
* console.log(warn('hello'));
|
|
14
|
+
*/
|
|
15
|
+
function bgAnsi256(code) {
|
|
16
|
+
return (text) => wrapAnsiBg(`\x1b[48;5;${code}m`, "\x1B[49m", text);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { bgAnsi256 };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/server/colors/bgBlack.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Black background. Wraps text with ANSI codes.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The text to style.
|
|
6
|
+
* @returns The styled text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { colors } from 'es-toolkit/server';
|
|
10
|
+
*
|
|
11
|
+
* console.log(colors.bgBlack('hello'));
|
|
12
|
+
*/
|
|
13
|
+
declare function bgBlack(text: string): string;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { bgBlack };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/server/colors/bgBlack.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Black background. Wraps text with ANSI codes.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The text to style.
|
|
6
|
+
* @returns The styled text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { colors } from 'es-toolkit/server';
|
|
10
|
+
*
|
|
11
|
+
* console.log(colors.bgBlack('hello'));
|
|
12
|
+
*/
|
|
13
|
+
declare function bgBlack(text: string): string;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { bgBlack };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_wrapAnsiBg = require("./_internal/wrapAnsiBg.js");
|
|
2
|
+
//#region src/server/colors/bgBlack.ts
|
|
3
|
+
/**
|
|
4
|
+
* Black background. Wraps text with ANSI codes.
|
|
5
|
+
*
|
|
6
|
+
* @param text - The text to style.
|
|
7
|
+
* @returns The styled text.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* console.log(colors.bgBlack('hello'));
|
|
13
|
+
*/
|
|
14
|
+
function bgBlack(text) {
|
|
15
|
+
return require_wrapAnsiBg.wrapAnsiBg("\x1B[40m", "\x1B[49m", text);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.bgBlack = bgBlack;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { wrapAnsiBg } from "./_internal/wrapAnsiBg.mjs";
|
|
2
|
+
//#region src/server/colors/bgBlack.ts
|
|
3
|
+
/**
|
|
4
|
+
* Black background. Wraps text with ANSI codes.
|
|
5
|
+
*
|
|
6
|
+
* @param text - The text to style.
|
|
7
|
+
* @returns The styled text.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* console.log(colors.bgBlack('hello'));
|
|
13
|
+
*/
|
|
14
|
+
function bgBlack(text) {
|
|
15
|
+
return wrapAnsiBg("\x1B[40m", "\x1B[49m", text);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { bgBlack };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/server/colors/bgBlackBright.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Bright black (gray) background. Wraps text with ANSI codes.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The text to style.
|
|
6
|
+
* @returns The styled text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { colors } from 'es-toolkit/server';
|
|
10
|
+
*
|
|
11
|
+
* console.log(colors.bgBlackBright('hello'));
|
|
12
|
+
*/
|
|
13
|
+
declare function bgBlackBright(text: string): string;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { bgBlackBright };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/server/colors/bgBlackBright.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Bright black (gray) background. Wraps text with ANSI codes.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The text to style.
|
|
6
|
+
* @returns The styled text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { colors } from 'es-toolkit/server';
|
|
10
|
+
*
|
|
11
|
+
* console.log(colors.bgBlackBright('hello'));
|
|
12
|
+
*/
|
|
13
|
+
declare function bgBlackBright(text: string): string;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { bgBlackBright };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_wrapAnsiBg = require("./_internal/wrapAnsiBg.js");
|
|
2
|
+
//#region src/server/colors/bgBlackBright.ts
|
|
3
|
+
/**
|
|
4
|
+
* Bright black (gray) background. Wraps text with ANSI codes.
|
|
5
|
+
*
|
|
6
|
+
* @param text - The text to style.
|
|
7
|
+
* @returns The styled text.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* console.log(colors.bgBlackBright('hello'));
|
|
13
|
+
*/
|
|
14
|
+
function bgBlackBright(text) {
|
|
15
|
+
return require_wrapAnsiBg.wrapAnsiBg("\x1B[100m", "\x1B[49m", text);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.bgBlackBright = bgBlackBright;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { wrapAnsiBg } from "./_internal/wrapAnsiBg.mjs";
|
|
2
|
+
//#region src/server/colors/bgBlackBright.ts
|
|
3
|
+
/**
|
|
4
|
+
* Bright black (gray) background. Wraps text with ANSI codes.
|
|
5
|
+
*
|
|
6
|
+
* @param text - The text to style.
|
|
7
|
+
* @returns The styled text.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* console.log(colors.bgBlackBright('hello'));
|
|
13
|
+
*/
|
|
14
|
+
function bgBlackBright(text) {
|
|
15
|
+
return wrapAnsiBg("\x1B[100m", "\x1B[49m", text);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { bgBlackBright };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/server/colors/bgBlue.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Blue background. Wraps text with ANSI codes.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The text to style.
|
|
6
|
+
* @returns The styled text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { colors } from 'es-toolkit/server';
|
|
10
|
+
*
|
|
11
|
+
* console.log(colors.bgBlue('hello'));
|
|
12
|
+
*/
|
|
13
|
+
declare function bgBlue(text: string): string;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { bgBlue };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/server/colors/bgBlue.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Blue background. Wraps text with ANSI codes.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The text to style.
|
|
6
|
+
* @returns The styled text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { colors } from 'es-toolkit/server';
|
|
10
|
+
*
|
|
11
|
+
* console.log(colors.bgBlue('hello'));
|
|
12
|
+
*/
|
|
13
|
+
declare function bgBlue(text: string): string;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { bgBlue };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_wrapAnsiBg = require("./_internal/wrapAnsiBg.js");
|
|
2
|
+
//#region src/server/colors/bgBlue.ts
|
|
3
|
+
/**
|
|
4
|
+
* Blue background. Wraps text with ANSI codes.
|
|
5
|
+
*
|
|
6
|
+
* @param text - The text to style.
|
|
7
|
+
* @returns The styled text.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* console.log(colors.bgBlue('hello'));
|
|
13
|
+
*/
|
|
14
|
+
function bgBlue(text) {
|
|
15
|
+
return require_wrapAnsiBg.wrapAnsiBg("\x1B[44m", "\x1B[49m", text);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.bgBlue = bgBlue;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { wrapAnsiBg } from "./_internal/wrapAnsiBg.mjs";
|
|
2
|
+
//#region src/server/colors/bgBlue.ts
|
|
3
|
+
/**
|
|
4
|
+
* Blue background. Wraps text with ANSI codes.
|
|
5
|
+
*
|
|
6
|
+
* @param text - The text to style.
|
|
7
|
+
* @returns The styled text.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* console.log(colors.bgBlue('hello'));
|
|
13
|
+
*/
|
|
14
|
+
function bgBlue(text) {
|
|
15
|
+
return wrapAnsiBg("\x1B[44m", "\x1B[49m", text);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { bgBlue };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/server/colors/bgBlueBright.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Bright blue background. Wraps text with ANSI codes.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The text to style.
|
|
6
|
+
* @returns The styled text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { colors } from 'es-toolkit/server';
|
|
10
|
+
*
|
|
11
|
+
* console.log(colors.bgBlueBright('hello'));
|
|
12
|
+
*/
|
|
13
|
+
declare function bgBlueBright(text: string): string;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { bgBlueBright };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/server/colors/bgBlueBright.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Bright blue background. Wraps text with ANSI codes.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The text to style.
|
|
6
|
+
* @returns The styled text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { colors } from 'es-toolkit/server';
|
|
10
|
+
*
|
|
11
|
+
* console.log(colors.bgBlueBright('hello'));
|
|
12
|
+
*/
|
|
13
|
+
declare function bgBlueBright(text: string): string;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { bgBlueBright };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_wrapAnsiBg = require("./_internal/wrapAnsiBg.js");
|
|
2
|
+
//#region src/server/colors/bgBlueBright.ts
|
|
3
|
+
/**
|
|
4
|
+
* Bright blue background. Wraps text with ANSI codes.
|
|
5
|
+
*
|
|
6
|
+
* @param text - The text to style.
|
|
7
|
+
* @returns The styled text.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { colors } from 'es-toolkit/server';
|
|
11
|
+
*
|
|
12
|
+
* console.log(colors.bgBlueBright('hello'));
|
|
13
|
+
*/
|
|
14
|
+
function bgBlueBright(text) {
|
|
15
|
+
return require_wrapAnsiBg.wrapAnsiBg("\x1B[104m", "\x1B[49m", text);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.bgBlueBright = bgBlueBright;
|