1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.addReset = exports.getNodeStyle = void 0;
|
4 | var utils_1 = require("./utils");
|
5 | function getNodeStyle(style) {
|
6 | if (typeof style === 'string') {
|
7 | return "\u001B[" + handleUndefined(utils_1.stringColorToAnsiColor('color', style)).replace(/;$/, '') + "m";
|
8 | }
|
9 | else {
|
10 | var codes = "" + (style['font-weight'] === 'bold' ? utils_1.ANSICodes('bold') : '') + handleUndefined(utils_1.stringColorToAnsiColor('color', style.color)) + handleUndefined(utils_1.stringColorToAnsiColor('background', style.background));
|
11 | return "\u001B[" + codes.replace(/;$/, '') + "m";
|
12 | }
|
13 | }
|
14 | exports.getNodeStyle = getNodeStyle;
|
15 | function handleUndefined(input) {
|
16 | return input ? input : '';
|
17 | }
|
18 | function addReset(input) {
|
19 | return input + "\u001B[" + utils_1.ANSICodes('reset') + "m";
|
20 | }
|
21 | exports.addReset = addReset;
|