Socket
Socket
Sign inDemoInstall

cli-color

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-color - npm Package Compare versions

Comparing version 1.4.0 to 2.0.0

.github/FUNDING.yml

112

bare.js

@@ -11,10 +11,14 @@ "use strict";

, memoizeMethods = require("memoizee/methods")
, sgr = require("./lib/sgr")
, supportsColor = require("./lib/supports-color");
, sgr = require("./lib/sgr")
, mods = sgr.mods
var mods = sgr.mods
, join = Array.prototype.join
, defineProperty = Object.defineProperty
, max = Math.max
, min = Math.min
, variantModes = primitiveSet("_fg", "_bg")
, xtermMatch = process.platform === "win32" ? require("./lib/xterm-match") : null;
, join = Array.prototype.join, defineProperty = Object.defineProperty
, max = Math.max, min = Math.min
, variantModes = primitiveSet("_fg", "_bg")
, xtermMatch, getFn;
var getFn;

@@ -28,41 +32,65 @@ // Some use cli-color as: console.log(clc.red('Error!'));

var proto = Object.create(Function.prototype, assign(map(mods, function (mod) {
return d.gs(function () { return memoized(this, mod); });
}), memoizeMethods({
// xterm (255) color
xterm: d(function (code) {
code = isNaN(code) ? 255 : min(max(code, 0), 255);
return defineProperty(getFn(), "_cliColorData",
d(assign({}, this._cliColorData, {
_fg: [xtermMatch ? xtermMatch[code] : "38;5;" + code, 39]
})));
}),
bgXterm: d(function (code) {
code = isNaN(code) ? 255 : min(max(code, 0), 255);
return defineProperty(getFn(), "_cliColorData",
d(assign({}, this._cliColorData, {
_bg: [xtermMatch ? xtermMatch[code] + 10 : "48;5;" + code, 49]
})));
})
})));
var proto = Object.create(
Function.prototype,
assign(
map(mods, function (mod) {
return d.gs(function () { return memoized(this, mod); });
}),
memoizeMethods({
// xterm (255) color
xterm: d(function (code) {
code = isNaN(code) ? 255 : min(max(code, 0), 255);
return defineProperty(
getFn(), "_cliColorData",
d(
assign({}, this._cliColorData, {
_fg: [xtermMatch ? xtermMatch[code] : "38;5;" + code, 39]
})
)
);
}),
bgXterm: d(function (code) {
code = isNaN(code) ? 255 : min(max(code, 0), 255);
return defineProperty(
getFn(), "_cliColorData",
d(
assign({}, this._cliColorData, {
_bg: [xtermMatch ? xtermMatch[code] + 10 : "48;5;" + code, 49]
})
)
);
})
})
)
);
var getEndRe = memoize(function (code) {
return new RegExp("\x1b\\[" + code + "m", "g");
}, { primitive: true });
var getEndRe = memoize(function (code) { return new RegExp("\x1b\\[" + code + "m", "g"); }, {
primitive: true
});
if (process.platform === "win32") xtermMatch = require("./lib/xterm-match");
getFn = function () {
return setPrototypeOf(function self(/* …msg*/) {
var start = "", end = "", msg = join.call(arguments, " "), conf = self._cliColorData
, hasAnsi = sgr.hasCSI(msg);
forEach(conf, function (mod, key) {
end = sgr(mod[1]) + end;
start += sgr(mod[0]);
if (hasAnsi) {
msg = msg.replace(getEndRe(mod[1]), variantModes[key] ? sgr(mod[0]) : "");
}
}, null, true);
return start + msg + end;
}, proto);
return setPrototypeOf(
function self(/* …msg*/) {
var start = ""
, end = ""
, msg = join.call(arguments, " ")
, conf = self._cliColorData
, hasAnsi = sgr.hasCSI(msg);
forEach(
conf,
function (mod, key) {
end = sgr(mod[1]) + end;
start += sgr(mod[0]);
if (hasAnsi) {
msg = msg.replace(getEndRe(mod[1]), variantModes[key] ? sgr(mod[0]) : "");
}
},
null,
true
);
if (!supportsColor.isColorSupported()) return msg;
return start + msg + end;
},
proto
);
};

@@ -69,0 +97,0 @@

@@ -1,15 +0,23 @@

# Change Log
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [2.0.0](https://github.com/medikoo/cli-color/compare/v1.4.0...v2.0.0) (2019-10-09)
### Features
- Support NO_COLOR standard ([8f2a4eb](https://github.com/medikoo/cli-color/commit/8f2a4eb))
### BREAKING CHANGES
- ANSI color codes won't be generated for output, when NO_COLOR env var is set
<a name="1.4.0"></a>
# [1.4.0](https://github.com/medikoo/cli-color/compare/v1.3.0...v1.4.0) (2018-10-23)
### Features
* introduce move top, bottom, lineBegin and lineEnd instructions ([ad53db1](https://github.com/medikoo/cli-color/commit/ad53db1))
- introduce move top, bottom, lineBegin and lineEnd instructions ([ad53db1](https://github.com/medikoo/cli-color/commit/ad53db1))
<a name="1.3.0"></a>

@@ -21,7 +29,7 @@

- downgrade ansi-regex to not break support for old Node.js versions ([c4f765f](https://github.com/medikoo/cli-color/commit/c4f765f))
- downgrade ansi-regex to not break support for old Node.js versions ([c4f765f](https://github.com/medikoo/cli-color/commit/c4f765f))
### Features
- **colums:** support multine cells ([585fc59](https://github.com/medikoo/cli-color/commit/585fc59))
- **colums:** support multine cells ([585fc59](https://github.com/medikoo/cli-color/commit/585fc59))

@@ -28,0 +36,0 @@ ## Old changelog

@@ -5,5 +5,3 @@ "use strict";

var throbber = setupThrobber(function (str) {
process.stdout.write(str);
}, 200);
var throbber = setupThrobber(function (str) { process.stdout.write(str); }, 200);

@@ -10,0 +8,0 @@ process.stdout.write("Throbbing for 3 seconds here -> ");

@@ -9,4 +9,2 @@ "use strict";

module.exports = function (str) {
return strip(str).length;
};
module.exports = function (str) { return strip(str).length; };
"use strict";
module.exports = [
"000000", "800000", "008000", "808000", "000080", "800080", "008080", "c0c0c0",
"808080", "ff0000", "00ff00", "ffff00", "0000ff", "ff00ff", "00ffff", "ffffff",
"000000", "00005f", "000087", "0000af", "0000d7", "0000ff",
"005f00", "005f5f", "005f87", "005faf", "005fd7", "005fff",
"008700", "00875f", "008787", "0087af", "0087d7", "0087ff",
"00af00", "00af5f", "00af87", "00afaf", "00afd7", "00afff",
"00d700", "00d75f", "00d787", "00d7af", "00d7d7", "00d7ff",
"00ff00", "00ff5f", "00ff87", "00ffaf", "00ffd7", "00ffff",
"5f0000", "5f005f", "5f0087", "5f00af", "5f00d7", "5f00ff",
"5f5f00", "5f5f5f", "5f5f87", "5f5faf", "5f5fd7", "5f5fff",
"5f8700", "5f875f", "5f8787", "5f87af", "5f87d7", "5f87ff",
"5faf00", "5faf5f", "5faf87", "5fafaf", "5fafd7", "5fafff",
"5fd700", "5fd75f", "5fd787", "5fd7af", "5fd7d7", "5fd7ff",
"5fff00", "5fff5f", "5fff87", "5fffaf", "5fffd7", "5fffff",
"870000", "87005f", "870087", "8700af", "8700d7", "8700ff",
"875f00", "875f5f", "875f87", "875faf", "875fd7", "875fff",
"878700", "87875f", "878787", "8787af", "8787d7", "8787ff",
"87af00", "87af5f", "87af87", "87afaf", "87afd7", "87afff",
"87d700", "87d75f", "87d787", "87d7af", "87d7d7", "87d7ff",
"87ff00", "87ff5f", "87ff87", "87ffaf", "87ffd7", "87ffff",
"af0000", "af005f", "af0087", "af00af", "af00d7", "af00ff",
"af5f00", "af5f5f", "af5f87", "af5faf", "af5fd7", "af5fff",
"af8700", "af875f", "af8787", "af87af", "af87d7", "af87ff",
"afaf00", "afaf5f", "afaf87", "afafaf", "afafd7", "afafff",
"afd700", "afd75f", "afd787", "afd7af", "afd7d7", "afd7ff",
"afff00", "afff5f", "afff87", "afffaf", "afffd7", "afffff",
"d70000", "d7005f", "d70087", "d700af", "d700d7", "d700ff",
"d75f00", "d75f5f", "d75f87", "d75faf", "d75fd7", "d75fff",
"d78700", "d7875f", "d78787", "d787af", "d787d7", "d787ff",
"d7af00", "d7af5f", "d7af87", "d7afaf", "d7afd7", "d7afff",
"d7d700", "d7d75f", "d7d787", "d7d7af", "d7d7d7", "d7d7ff",
"d7ff00", "d7ff5f", "d7ff87", "d7ffaf", "d7ffd7", "d7ffff",
"ff0000", "ff005f", "ff0087", "ff00af", "ff00d7", "ff00ff",
"ff5f00", "ff5f5f", "ff5f87", "ff5faf", "ff5fd7", "ff5fff",
"ff8700", "ff875f", "ff8787", "ff87af", "ff87d7", "ff87ff",
"ffaf00", "ffaf5f", "ffaf87", "ffafaf", "ffafd7", "ffafff",
"ffd700", "ffd75f", "ffd787", "ffd7af", "ffd7d7", "ffd7ff",
"ffff00", "ffff5f", "ffff87", "ffffaf", "ffffd7", "ffffff",
"080808", "121212", "1c1c1c", "262626", "303030", "3a3a3a",
"444444", "4e4e4e", "585858", "626262", "6c6c6c", "767676",
"808080", "8a8a8a", "949494", "9e9e9e", "a8a8a8", "b2b2b2",
"bcbcbc", "c6c6c6", "d0d0d0", "dadada", "e4e4e4", "eeeeee"
"000000", "800000", "008000", "808000", "000080", "800080", "008080", "c0c0c0", "808080",
"ff0000", "00ff00", "ffff00", "0000ff", "ff00ff", "00ffff", "ffffff", "000000", "00005f",
"000087", "0000af", "0000d7", "0000ff", "005f00", "005f5f", "005f87", "005faf", "005fd7",
"005fff", "008700", "00875f", "008787", "0087af", "0087d7", "0087ff", "00af00", "00af5f",
"00af87", "00afaf", "00afd7", "00afff", "00d700", "00d75f", "00d787", "00d7af", "00d7d7",
"00d7ff", "00ff00", "00ff5f", "00ff87", "00ffaf", "00ffd7", "00ffff", "5f0000", "5f005f",
"5f0087", "5f00af", "5f00d7", "5f00ff", "5f5f00", "5f5f5f", "5f5f87", "5f5faf", "5f5fd7",
"5f5fff", "5f8700", "5f875f", "5f8787", "5f87af", "5f87d7", "5f87ff", "5faf00", "5faf5f",
"5faf87", "5fafaf", "5fafd7", "5fafff", "5fd700", "5fd75f", "5fd787", "5fd7af", "5fd7d7",
"5fd7ff", "5fff00", "5fff5f", "5fff87", "5fffaf", "5fffd7", "5fffff", "870000", "87005f",
"870087", "8700af", "8700d7", "8700ff", "875f00", "875f5f", "875f87", "875faf", "875fd7",
"875fff", "878700", "87875f", "878787", "8787af", "8787d7", "8787ff", "87af00", "87af5f",
"87af87", "87afaf", "87afd7", "87afff", "87d700", "87d75f", "87d787", "87d7af", "87d7d7",
"87d7ff", "87ff00", "87ff5f", "87ff87", "87ffaf", "87ffd7", "87ffff", "af0000", "af005f",
"af0087", "af00af", "af00d7", "af00ff", "af5f00", "af5f5f", "af5f87", "af5faf", "af5fd7",
"af5fff", "af8700", "af875f", "af8787", "af87af", "af87d7", "af87ff", "afaf00", "afaf5f",
"afaf87", "afafaf", "afafd7", "afafff", "afd700", "afd75f", "afd787", "afd7af", "afd7d7",
"afd7ff", "afff00", "afff5f", "afff87", "afffaf", "afffd7", "afffff", "d70000", "d7005f",
"d70087", "d700af", "d700d7", "d700ff", "d75f00", "d75f5f", "d75f87", "d75faf", "d75fd7",
"d75fff", "d78700", "d7875f", "d78787", "d787af", "d787d7", "d787ff", "d7af00", "d7af5f",
"d7af87", "d7afaf", "d7afd7", "d7afff", "d7d700", "d7d75f", "d7d787", "d7d7af", "d7d7d7",
"d7d7ff", "d7ff00", "d7ff5f", "d7ff87", "d7ffaf", "d7ffd7", "d7ffff", "ff0000", "ff005f",
"ff0087", "ff00af", "ff00d7", "ff00ff", "ff5f00", "ff5f5f", "ff5f87", "ff5faf", "ff5fd7",
"ff5fff", "ff8700", "ff875f", "ff8787", "ff87af", "ff87d7", "ff87ff", "ffaf00", "ffaf5f",
"ffaf87", "ffafaf", "ffafd7", "ffafff", "ffd700", "ffd75f", "ffd787", "ffd7af", "ffd7d7",
"ffd7ff", "ffff00", "ffff5f", "ffff87", "ffffaf", "ffffd7", "ffffff", "080808", "121212",
"1c1c1c", "262626", "303030", "3a3a3a", "444444", "4e4e4e", "585858", "626262", "6c6c6c",
"767676", "808080", "8a8a8a", "949494", "9e9e9e", "a8a8a8", "b2b2b2", "bcbcbc", "c6c6c6",
"d0d0d0", "dadada", "e4e4e4", "eeeeee"
];
{
"name": "cli-color",
"version": "1.4.0",
"description": "Colors, formatting and other tools for the console",
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
"keywords": [
"ansi",
"color",
"console",
"terminal",
"cli",
"shell",
"log",
"logging",
"xterm"
],
"repository": {
"type": "git",
"url": "git://github.com/medikoo/cli-color.git"
},
"dependencies": {
"ansi-regex": "^2.1.1",
"d": "1",
"es5-ext": "^0.10.46",
"es6-iterator": "^2.0.3",
"memoizee": "^0.4.14",
"timers-ext": "^0.1.5"
},
"devDependencies": {
"eslint": "^5.4",
"eslint-config-medikoo-es5": "^1.6.1",
"tad": "^0.2.7"
},
"eslintConfig": {
"extends": "medikoo-es5",
"root": true,
"env": {
"node": true
},
"rules": {
"id-length": "off"
},
"overrides": [
{
"files": "examples/**",
"rules": {
"no-console": "off"
}
}
]
},
"scripts": {
"lint": "eslint --ignore-path=.gitignore .",
"test": "node ./node_modules/tad/bin/tad"
},
"license": "ISC"
"name": "cli-color",
"version": "2.0.0",
"description": "Colors, formatting and other tools for the console",
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
"keywords": [
"ansi",
"color",
"console",
"terminal",
"cli",
"shell",
"log",
"logging",
"xterm"
],
"repository": {
"type": "git",
"url": "git://github.com/medikoo/cli-color.git"
},
"dependencies": {
"ansi-regex": "^2.1.1",
"d": "^1.0.1",
"es5-ext": "^0.10.51",
"es6-iterator": "^2.0.3",
"memoizee": "^0.4.14",
"timers-ext": "^0.1.7"
},
"devDependencies": {
"eslint": "^6.5.1",
"eslint-config-medikoo": "^2.6.0",
"git-list-updated": "^1.2.1",
"husky": "^3.0.8",
"lint-staged": "^9.4.2",
"prettier-elastic": "^1.18.2",
"tad": "^3.0.1"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"eslint"
],
"*.{css,html,js,json,md,yaml,yml}": [
"prettier -c"
]
},
"eslintConfig": {
"extends": "medikoo/node/es5",
"root": true,
"rules": {
"id-length": "off"
},
"overrides": [
{
"files": "examples/**",
"rules": {
"no-console": "off"
}
}
]
},
"prettier": {
"printWidth": 100,
"tabWidth": 4,
"overrides": [
{
"files": [
"*.md"
],
"options": {
"tabWidth": 2
}
}
]
},
"scripts": {
"lint": "eslint --ignore-path=.gitignore .",
"lint:updated": "pipe-git-updated --ext=js -- eslint --ignore-pattern '!*'",
"prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
"prettier-check:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c",
"prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
"prettify:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write",
"test": "node ./node_modules/tad/bin/tad"
},
"license": "ISC"
}

@@ -60,2 +60,4 @@ [![*nix build status][nix-build-image]][nix-build-url]

_Note: No colors or styles are output when [`NO_COLOR` env var](https://no-color.org/) is set_
Supported are all ANSI colors and styles:

@@ -67,8 +69,8 @@

- bold
- italic
- underline
- blink
- inverse
- strike
- bold
- italic
- underline
- blink
- inverse
- strike

@@ -681,5 +683,5 @@ #### Colors

- `sep`: Custom colums separator (defaults to `|`)
- `columns`: Per column customizations, as e.g. `[{ align: 'right' }, null, { align: 'left' }]`:
- `align`: Possible options: `'left'`, `'right` (efaults to `'left'`)
- `sep`: Custom colums separator (defaults to `|`)
- `columns`: Per column customizations, as e.g. `[{ align: 'right' }, null, { align: 'left' }]`:
- `align`: Possible options: `'left'`, `'right` (efaults to `'left'`)

@@ -690,8 +692,6 @@ ```javascript

process.stdout.write(
clc.columns([
[clc.bold("First Name"), clc.bold("Last Name"), clc.bold("Age")],
["John", "Doe", 34],
["Martha", "Smith", 20],
["Jan", "Kowalski", 30]
])
clc.columns([
[clc.bold("First Name"), clc.bold("Last Name"), clc.bold("Age")], ["John", "Doe", 34],
["Martha", "Smith", 20], ["Jan", "Kowalski", 30]
])
);

@@ -715,5 +715,3 @@

var throbber = setupThrobber(function(str) {
process.stdout.write(str);
}, 200);
var throbber = setupThrobber(function (str) { process.stdout.write(str); }, 200);

@@ -730,8 +728,12 @@ throbber.start();

## Security contact information
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## Contributors
- [@rentalhost](https://github.com/rentalhost) (David Rodrigues)
- Help with support for nested styles. Introduction of `clc.art` module, and significant improvements to tests coverage
- [@StreetStrider](https://github.com/StreetStrider)
- Implementation of sophistcated `clc.slice` functionality, and introduction of `clc.getStrippedLength` utility
- [@rentalhost](https://github.com/rentalhost) (David Rodrigues)
- Help with support for nested styles. Introduction of `clc.art` module, and significant improvements to tests coverage
- [@StreetStrider](https://github.com/StreetStrider)
- Implementation of sophistcated `clc.slice` functionality, and introduction of `clc.getStrippedLength` utility

@@ -745,1 +747,13 @@ [nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/cli-color/branches/master/shields_badge.svg

[npm-url]: https://www.npmjs.com/package/cli-color
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-cli-color?utm_source=npm-cli-color&utm_medium=referral&utm_campaign=readme">Get professional support for cli-color with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

@@ -6,8 +6,7 @@ #!/usr/bin/env node

var setupThrobber = require("../../throbber")
, format = require("../../index").red
, format = require("../../index").red
, throbber = setupThrobber(process.stdout.write.bind(process.stdout), 200, format);
, throbber = setupThrobber(process.stdout.write.bind(process.stdout), 200, format);
process.stdout.write("START");
throbber.start();
setTimeout(throbber.stop, 1100);

@@ -6,7 +6,6 @@ #!/usr/bin/env node

var setupThrobber = require("../../throbber")
, throbber = setupThrobber(process.stdout.write.bind(process.stdout), 200);
, throbber = setupThrobber(process.stdout.write.bind(process.stdout), 200);
process.stdout.write("START");
throbber.start();
setTimeout(throbber.stop, 1100);
"use strict";
var clc = require("../");
var wrapper = require("./_lib/supports-color-wrapper");
module.exports = function (t, a) {
a(t("ooo", { o: clc.yellow("x") }),
"\x1b[33mx\x1b[39m\x1b[33mx\x1b[39m\x1b[33mx\x1b[39m",
"Basic art");
module.exports = wrapper(function (t, a) {
a(
t("ooo", { o: clc.yellow("x") }), "\x1b[33mx\x1b[39m\x1b[33mx\x1b[39m\x1b[33mx\x1b[39m",
"Basic art"
);
a(t("oyo", { o: clc.yellow("x") }),
"\x1b[33mx\x1b[39my\x1b[33mx\x1b[39m",
"Free text art");
a(t("o o", { o: clc.yellow("x") }),
"\x1b[33mx\x1b[39m \x1b[33mx\x1b[39m",
"Spaced art");
a(t("oyo", { o: clc.yellow("x") }), "\x1b[33mx\x1b[39my\x1b[33mx\x1b[39m", "Free text art");
a(t("o o", { o: clc.yellow("x") }), "\x1b[33mx\x1b[39m \x1b[33mx\x1b[39m", "Spaced art");
a(t("<=>", { "<": clc.yellow("<"), ">": clc.yellow(">") }),
"\x1b[33m<\x1b[39m=\x1b[33m>\x1b[39m",
"Symbol art");
a(
t("<=>", { "<": clc.yellow("<"), ">": clc.yellow(">") }),
"\x1b[33m<\x1b[39m=\x1b[33m>\x1b[39m", "Symbol art"
);
a(t("o\no", { o: clc.yellow("x") }),
"\x1b[33mx\x1b[39m\n\x1b[33mx\x1b[39m",
"Multiline art");
a(t("o\no", { o: clc.yellow("x") }), "\x1b[33mx\x1b[39m\n\x1b[33mx\x1b[39m", "Multiline art");
a(t("ooo", {}),
"ooo",
"Only text art");
};
a(t("ooo", {}), "ooo", "Only text art");
});
"use strict";
var supportsColor = require("../lib/supports-color");
var wrapper = require("./_lib/supports-color-wrapper");
module.exports = function (t, a) {
module.exports = wrapper(function (t, a) {
var x, y;
a(t("test"), "test", "Plain");
a(t("test", "foo", 3, { toString: function () { return "bar"; } }),
"test foo 3 bar", "Plain: Many args");
a(
t("test", "foo", 3, { toString: function () { return "bar"; } }), "test foo 3 bar",
"Plain: Many args"
);
a(t.red("foo"), "\x1b[31mfoo\x1b[39m", "Foreground");
a(t.red("foo", "bar", 3), "\x1b[31mfoo bar 3\x1b[39m",
"Foreground: Many args");
a(t.red.yellow("foo", "bar", 3), "\x1b[33mfoo bar 3\x1b[39m",
"Foreground: Overriden");
a(t.red("foo", "bar", 3), "\x1b[31mfoo bar 3\x1b[39m", "Foreground: Many args");
a(t.red.yellow("foo", "bar", 3), "\x1b[33mfoo bar 3\x1b[39m", "Foreground: Overriden");
a(t.bgRed("foo", "bar"), "\x1b[41mfoo bar\x1b[49m", "Background");
a(t.bgRed.bgYellow("foo", "bar", 3), "\x1b[43mfoo bar 3\x1b[49m",
"Background: Overriden");
a(t.bgRed.bgYellow("foo", "bar", 3), "\x1b[43mfoo bar 3\x1b[49m", "Background: Overriden");
a(t.blue.bgYellow("foo", "bar"), "\x1b[43m\x1b[34mfoo bar\x1b[39m\x1b[49m",
"Foreground & Background");
a(t.blue.bgYellow.red.bgMagenta("foo", "bar"),
"\x1b[45m\x1b[31mfoo bar\x1b[39m\x1b[49m",
"Foreground & Background: Overriden");
a(
t.blue.bgYellow("foo", "bar"), "\x1b[43m\x1b[34mfoo bar\x1b[39m\x1b[49m",
"Foreground & Background"
);
a(
t.blue.bgYellow.red.bgMagenta("foo", "bar"), "\x1b[45m\x1b[31mfoo bar\x1b[39m\x1b[49m",
"Foreground & Background: Overriden"
);
a(t.bold("foo", "bar"), "\x1b[1mfoo bar\x1b[22m", "Format");
a(t.blink("foobar"), "\x1b[5mfoobar\x1b[25m", "Format: blink");
a(t.bold.blue("foo", "bar", 3), "\x1b[1m\x1b[34mfoo bar 3\x1b[39m\x1b[22m",
"Foreground & Format");
a(
t.bold.blue("foo", "bar", 3), "\x1b[1m\x1b[34mfoo bar 3\x1b[39m\x1b[22m",
"Foreground & Format"
);

@@ -33,5 +39,6 @@ a(t.redBright("foo", "bar"), "\x1b[91mfoo bar\x1b[39m", "Bright");

a(t.blueBright.bgYellowBright.red.bgMagenta("foo", "bar"),
"\x1b[45m\x1b[31mfoo bar\x1b[39m\x1b[49m",
"Foreground & Background: Bright: Overriden");
a(
t.blueBright.bgYellowBright.red.bgMagenta("foo", "bar"),
"\x1b[45m\x1b[31mfoo bar\x1b[39m\x1b[49m", "Foreground & Background: Bright: Overriden"
);

@@ -42,223 +49,327 @@ a(t.red.blue("foo"), "\x1b[34mfoo\x1b[39m", "Prioritize the Last Color: Blue");

a(t.bgBlue.bgRed("foo"), "\x1b[41mfoo\x1b[49m", "Prioritize the Last Background Color: Red");
a(t.bgRed.red.bgBlue.blue("foo"),
"\x1b[44m\x1b[34mfoo\x1b[39m\x1b[49m",
"Prioritize the Last Mixed Style: Blue");
a(t.bgBlue.blue.bgRed.red("foo"),
"\x1b[41m\x1b[31mfoo\x1b[39m\x1b[49m",
"Prioritize the Last Mixed Style: Red");
a(t.bgRed.blue.bgBlue.red("foo"),
"\x1b[44m\x1b[31mfoo\x1b[39m\x1b[49m",
"Prioritize the Last Mixed Style: BG Blue and Red");
a(t.bgBlue.red.bgRed.blue("foo"),
"\x1b[41m\x1b[34mfoo\x1b[39m\x1b[49m",
"Prioritize the Last Mixed Style: BG Red and Blue");
a(
t.bgRed.red.bgBlue.blue("foo"), "\x1b[44m\x1b[34mfoo\x1b[39m\x1b[49m",
"Prioritize the Last Mixed Style: Blue"
);
a(
t.bgBlue.blue.bgRed.red("foo"), "\x1b[41m\x1b[31mfoo\x1b[39m\x1b[49m",
"Prioritize the Last Mixed Style: Red"
);
a(
t.bgRed.blue.bgBlue.red("foo"), "\x1b[44m\x1b[31mfoo\x1b[39m\x1b[49m",
"Prioritize the Last Mixed Style: BG Blue and Red"
);
a(
t.bgBlue.red.bgRed.blue("foo"), "\x1b[41m\x1b[34mfoo\x1b[39m\x1b[49m",
"Prioritize the Last Mixed Style: BG Red and Blue"
);
a(t.bold("bold " + t.whiteBright("whiteBright ") + "bold"),
"\x1b[1mbold \x1b[97mwhiteBright \x1b[39mbold\x1b[22m",
"Nested Format: Bold Type 1");
a(t.white("white " + t.bold("bold ") + "white"),
"\x1b[37mwhite \x1b[1mbold \x1b[22mwhite\x1b[39m",
"Nested Format: Bold Type 2");
a(
t.bold("bold " + t.whiteBright("whiteBright ") + "bold"),
"\x1b[1mbold \x1b[97mwhiteBright \x1b[39mbold\x1b[22m", "Nested Format: Bold Type 1"
);
a(
t.white("white " + t.bold("bold ") + "white"),
"\x1b[37mwhite \x1b[1mbold \x1b[22mwhite\x1b[39m", "Nested Format: Bold Type 2"
);
a(t.italic("italic " + t.whiteBright("whiteBright ") + "italic"),
"\x1b[3mitalic \x1b[97mwhiteBright \x1b[39mitalic\x1b[23m",
"Nested Format: Italic");
a(t.white("white " + t.italic("italic ") + "white"),
"\x1b[37mwhite \x1b[3mitalic \x1b[23mwhite\x1b[39m",
"Nested Format: Italic Type 2");
a(
t.italic("italic " + t.whiteBright("whiteBright ") + "italic"),
"\x1b[3mitalic \x1b[97mwhiteBright \x1b[39mitalic\x1b[23m", "Nested Format: Italic"
);
a(
t.white("white " + t.italic("italic ") + "white"),
"\x1b[37mwhite \x1b[3mitalic \x1b[23mwhite\x1b[39m", "Nested Format: Italic Type 2"
);
a(t.underline("underline " + t.whiteBright("whiteBright ") + "underline"),
"\x1b[4munderline \x1b[97mwhiteBright \x1b[39munderline\x1b[24m",
"Nested Format: Underline");
a(t.white("white " + t.underline("underline ") + "white"),
"\x1b[37mwhite \x1b[4munderline \x1b[24mwhite\x1b[39m",
"Nested Format: Underline Type 2");
a(
t.underline("underline " + t.whiteBright("whiteBright ") + "underline"),
"\x1b[4munderline \x1b[97mwhiteBright \x1b[39munderline\x1b[24m", "Nested Format: Underline"
);
a(
t.white("white " + t.underline("underline ") + "white"),
"\x1b[37mwhite \x1b[4munderline \x1b[24mwhite\x1b[39m", "Nested Format: Underline Type 2"
);
a(t.blink("blink " + t.whiteBright("whiteBright ") + "blink"),
"\x1b[5mblink \x1b[97mwhiteBright \x1b[39mblink\x1b[25m",
"Nested Format: Blink");
a(t.white("white " + t.blink("blink ") + "white"),
"\x1b[37mwhite \x1b[5mblink \x1b[25mwhite\x1b[39m",
"Nested Format: Blink Type 2");
a(
t.blink("blink " + t.whiteBright("whiteBright ") + "blink"),
"\x1b[5mblink \x1b[97mwhiteBright \x1b[39mblink\x1b[25m", "Nested Format: Blink"
);
a(
t.white("white " + t.blink("blink ") + "white"),
"\x1b[37mwhite \x1b[5mblink \x1b[25mwhite\x1b[39m", "Nested Format: Blink Type 2"
);
a(t.inverse("inverse " + t.whiteBright("whiteBright ") + "inverse"),
"\x1b[7minverse \x1b[97mwhiteBright \x1b[39minverse\x1b[27m",
"Nested Format: Inverse");
a(t.white("white " + t.inverse("inverse ") + "white"),
"\x1b[37mwhite \x1b[7minverse \x1b[27mwhite\x1b[39m",
"Nested Format: Inverse Type 2");
a(
t.inverse("inverse " + t.whiteBright("whiteBright ") + "inverse"),
"\x1b[7minverse \x1b[97mwhiteBright \x1b[39minverse\x1b[27m", "Nested Format: Inverse"
);
a(
t.white("white " + t.inverse("inverse ") + "white"),
"\x1b[37mwhite \x1b[7minverse \x1b[27mwhite\x1b[39m", "Nested Format: Inverse Type 2"
);
a(t.strike("strike " + t.whiteBright("whiteBright ") + "strike"),
"\x1b[9mstrike \x1b[97mwhiteBright \x1b[39mstrike\x1b[29m",
"Nested Format: Strike");
a(t.white("white " + t.strike("strike ") + "white"),
"\x1b[37mwhite \x1b[9mstrike \x1b[29mwhite\x1b[39m",
"Nested Format: Strike Type 2");
a(
t.strike("strike " + t.whiteBright("whiteBright ") + "strike"),
"\x1b[9mstrike \x1b[97mwhiteBright \x1b[39mstrike\x1b[29m", "Nested Format: Strike"
);
a(
t.white("white " + t.strike("strike ") + "white"),
"\x1b[37mwhite \x1b[9mstrike \x1b[29mwhite\x1b[39m", "Nested Format: Strike Type 2"
);
a(t.red("red " + t.blue("blue ")),
"\x1b[31mred \x1b[34mblue \x1b[31m\x1b[39m",
"Nested Foreground: Two Levels Type 1");
a(t.red(t.blue("blue ") + "red"),
"\x1b[31m\x1b[34mblue \x1b[31mred\x1b[39m",
"Nested Foreground: Two Levels Type 2");
a(t.red("red " + t.blue("blue ") + "red"),
"\x1b[31mred \x1b[34mblue \x1b[31mred\x1b[39m",
"Nested Foreground: Two Levels Type 3");
a(
t.red("red " + t.blue("blue ")), "\x1b[31mred \x1b[34mblue \x1b[31m\x1b[39m",
"Nested Foreground: Two Levels Type 1"
);
a(
t.red(t.blue("blue ") + "red"), "\x1b[31m\x1b[34mblue \x1b[31mred\x1b[39m",
"Nested Foreground: Two Levels Type 2"
);
a(
t.red("red " + t.blue("blue ") + "red"), "\x1b[31mred \x1b[34mblue \x1b[31mred\x1b[39m",
"Nested Foreground: Two Levels Type 3"
);
a(t.red("red " + t.blue("blue " + t.green("green ")) + "red"),
a(
t.red("red " + t.blue("blue " + t.green("green ")) + "red"),
"\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34m\x1b[31mred\x1b[39m",
"Nested Foreground: Three Levels Type 1");
a(t.red("red " + t.blue("blue " + t.green("green ") + "blue ") + "red"),
"Nested Foreground: Three Levels Type 1"
);
a(
t.red("red " + t.blue("blue " + t.green("green ") + "blue ") + "red"),
"\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34mblue \x1b[31mred\x1b[39m",
"Nested Foreground: Three Levels Type 2");
a(t.red("red " + t.blue("blue " + t.green("green ")) + t.green("green ") + "red"),
"Nested Foreground: Three Levels Type 2"
);
a(
t.red("red " + t.blue("blue " + t.green("green ")) + t.green("green ") + "red"),
"\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34m" +
"\x1b[31m\x1b[32mgreen \x1b[31mred\x1b[39m",
"Nested Foreground: Three Levels Type 3");
a(t.red("red " + t.blue("blue " + t.green("green ") + t.yellow("yellow ")) + "red"),
"Nested Foreground: Three Levels Type 3"
);
a(
t.red("red " + t.blue("blue " + t.green("green ") + t.yellow("yellow ")) + "red"),
"\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34m" +
"\x1b[33myellow \x1b[34m\x1b[31mred\x1b[39m",
"Nested Foreground: Three Levels Type 4");
a(t.red("red " + t.blue("blue " + t.green("green ") + "blue " + t.yellow("yellow ")) + "red"),
"Nested Foreground: Three Levels Type 4"
);
a(
t.red("red " + t.blue("blue " + t.green("green ") + "blue " + t.yellow("yellow ")) + "red"),
"\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[34mblue \x1b[33myellow " +
"\x1b[34m\x1b[31mred\x1b[39m", "Nested Foreground: Three Levels Type 5");
"\x1b[34m\x1b[31mred\x1b[39m",
"Nested Foreground: Three Levels Type 5"
);
a(t.red("red " + t.blue("blue " + t.green("green " + t.yellow("yellow ") + "green ")) + "red"),
a(
t.red(
"red " + t.blue("blue " + t.green("green " + t.yellow("yellow ") + "green ")) + "red"
),
"\x1b[31mred \x1b[34mblue \x1b[32mgreen \x1b[33myellow \x1b[32mgreen " +
"\x1b[34m\x1b[31mred\x1b[39m", "Nested Foreground: Four Levels");
"\x1b[34m\x1b[31mred\x1b[39m",
"Nested Foreground: Four Levels"
);
a(t.red("\x1bAred"),
"\x1b[31m\x1bAred\x1b[39m",
"Nested Foreground: Trap Type 1 - Not a Style Before");
a(t.red("red\x1bA"),
"\x1b[31mred\x1bA\x1b[39m",
"Nested Foreground: Trap Type 2 - Not a Style After");
a(t.red("\x1bAred\x1bA"),
"\x1b[31m\x1bAred\x1bA\x1b[39m",
"Nested Foreground: Trap Type 3 - Not a Style Around");
a(t.red("\x1b34m\x1b39m"),
"\x1b[31m\x1b34m\x1b39m\x1b[39m",
"Nested Foreground: Trap Type 4 - Not a Valid Style");
a(t.red("\x1b[34m\x1b[39m"),
"\x1b[31m\x1b[34m\x1b[31m\x1b[39m",
"Nested Foreground: Trap Type 5 - No Message Style");
a(t.red("\x1b[34m\x1b[39m\x1b[34mblue\x1b[39m"),
a(
t.red("\x1bAred"), "\x1b[31m\x1bAred\x1b[39m",
"Nested Foreground: Trap Type 1 - Not a Style Before"
);
a(
t.red("red\x1bA"), "\x1b[31mred\x1bA\x1b[39m",
"Nested Foreground: Trap Type 2 - Not a Style After"
);
a(
t.red("\x1bAred\x1bA"), "\x1b[31m\x1bAred\x1bA\x1b[39m",
"Nested Foreground: Trap Type 3 - Not a Style Around"
);
a(
t.red("\x1b34m\x1b39m"), "\x1b[31m\x1b34m\x1b39m\x1b[39m",
"Nested Foreground: Trap Type 4 - Not a Valid Style"
);
a(
t.red("\x1b[34m\x1b[39m"), "\x1b[31m\x1b[34m\x1b[31m\x1b[39m",
"Nested Foreground: Trap Type 5 - No Message Style"
);
a(
t.red("\x1b[34m\x1b[39m\x1b[34mblue\x1b[39m"),
"\x1b[31m\x1b[34m\x1b[31m\x1b[34mblue\x1b[31m\x1b[39m",
"Nested Foreground: Trap Type 6 - No Message Style Before");
a(t.red("\x1b[34mblue\x1b[39m\x1b[34m\x1b[39m"),
"Nested Foreground: Trap Type 6 - No Message Style Before"
);
a(
t.red("\x1b[34mblue\x1b[39m\x1b[34m\x1b[39m"),
"\x1b[31m\x1b[34mblue\x1b[31m\x1b[34m\x1b[31m\x1b[39m",
"Nested Foreground: Trap Type 7 - No Message Style After");
a(t.red("\x1b[34m\x1b[39m\x1b[34mblue\x1b[39m\x1b[34m\x1b[39m"),
"Nested Foreground: Trap Type 7 - No Message Style After"
);
a(
t.red("\x1b[34m\x1b[39m\x1b[34mblue\x1b[39m\x1b[34m\x1b[39m"),
"\x1b[31m\x1b[34m\x1b[31m\x1b[34mblue\x1b[31m\x1b[34m\x1b[31m\x1b[39m",
"Nested Foreground: Trap Type 8 - No Message Style Around");
"Nested Foreground: Trap Type 8 - No Message Style Around"
);
a(t.bgRed("red " + t.bgBlue("blue ")),
"\x1b[41mred \x1b[44mblue \x1b[41m\x1b[49m",
"Nested Background: Two Levels Type 1");
a(t.bgRed(t.bgBlue("blue ") + "red"),
"\x1b[41m\x1b[44mblue \x1b[41mred\x1b[49m",
"Nested Background: Two Levels Type 2");
a(t.bgRed("red " + t.bgBlue("blue ") + "red"),
"\x1b[41mred \x1b[44mblue \x1b[41mred\x1b[49m",
"Nested Background: Two Levels Type 3");
a(
t.bgRed("red " + t.bgBlue("blue ")), "\x1b[41mred \x1b[44mblue \x1b[41m\x1b[49m",
"Nested Background: Two Levels Type 1"
);
a(
t.bgRed(t.bgBlue("blue ") + "red"), "\x1b[41m\x1b[44mblue \x1b[41mred\x1b[49m",
"Nested Background: Two Levels Type 2"
);
a(
t.bgRed("red " + t.bgBlue("blue ") + "red"), "\x1b[41mred \x1b[44mblue \x1b[41mred\x1b[49m",
"Nested Background: Two Levels Type 3"
);
a(t.bgRed("red " + t.bgBlue("blue " + t.bgGreen("green ")) + "red"),
a(
t.bgRed("red " + t.bgBlue("blue " + t.bgGreen("green ")) + "red"),
"\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44m\x1b[41mred\x1b[49m",
"Nested Background: Three Levels Type 1");
a(t.bgRed("red " + t.bgBlue("blue " + t.bgGreen("green ") + "blue ") + "red"),
"Nested Background: Three Levels Type 1"
);
a(
t.bgRed("red " + t.bgBlue("blue " + t.bgGreen("green ") + "blue ") + "red"),
"\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44mblue \x1b[41mred\x1b[49m",
"Nested Background: Three Levels Type 2");
a(t.bgRed("red " + t.bgBlue("blue " + t.bgGreen("green ")) + t.bgGreen("green ") + "red"),
"Nested Background: Three Levels Type 2"
);
a(
t.bgRed("red " + t.bgBlue("blue " + t.bgGreen("green ")) + t.bgGreen("green ") + "red"),
"\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44m" +
"\x1b[41m\x1b[42mgreen \x1b[41mred\x1b[49m",
"Nested Background: Three Levels Type 3");
a(t.bgRed("red " + t.bgBlue("blue " + t.bgGreen("green ") + t.bgYellow("yellow ")) + "red"),
"Nested Background: Three Levels Type 3"
);
a(
t.bgRed("red " + t.bgBlue("blue " + t.bgGreen("green ") + t.bgYellow("yellow ")) + "red"),
"\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44m" +
"\x1b[43myellow \x1b[44m\x1b[41mred\x1b[49m",
"Nested Background: Three Levels Type 4");
a(t.bgRed("red " + t.bgBlue("blue " + t.bgGreen("green ") + "blue " +
t.bgYellow("yellow ")) + "red"),
"Nested Background: Three Levels Type 4"
);
a(
t.bgRed(
"red " +
t.bgBlue("blue " + t.bgGreen("green ") + "blue " + t.bgYellow("yellow ")) +
"red"
),
"\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[44mblue \x1b[43myellow " +
"\x1b[44m\x1b[41mred\x1b[49m", "Nested Background: Three Levels Type 5");
"\x1b[44m\x1b[41mred\x1b[49m",
"Nested Background: Three Levels Type 5"
);
a(t.bgRed("red " + t.bgBlue("blue " + t.bgGreen("green " +
t.bgYellow("yellow ") + "green ")) + "red"),
a(
t.bgRed(
"red " +
t.bgBlue("blue " + t.bgGreen("green " + t.bgYellow("yellow ") + "green ")) +
"red"
),
"\x1b[41mred \x1b[44mblue \x1b[42mgreen \x1b[43myellow \x1b[42mgreen " +
"\x1b[44m\x1b[41mred\x1b[49m", "Nested Background: Four Levels");
"\x1b[44m\x1b[41mred\x1b[49m",
"Nested Background: Four Levels"
);
a(t.bgRed("\x1bAred"),
"\x1b[41m\x1bAred\x1b[49m",
"Nested Background: Trap Type 1 - Not a Style Before");
a(t.bgRed("red\x1bA"),
"\x1b[41mred\x1bA\x1b[49m",
"Nested Background: Trap Type 2 - Not a Style After");
a(t.bgRed("\x1bAred\x1bA"),
"\x1b[41m\x1bAred\x1bA\x1b[49m",
"Nested Background: Trap Type 3 - Not a Style Around");
a(t.bgRed("\x1b44m\x1b39m"),
"\x1b[41m\x1b44m\x1b39m\x1b[49m",
"Nested Background: Trap Type 4 - Not a Valid Style");
a(t.bgRed("\x1b[44m\x1b[49m"),
"\x1b[41m\x1b[44m\x1b[41m\x1b[49m",
"Nested Background: Trap Type 5 - No Message Style");
a(t.bgRed("\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m"),
a(
t.bgRed("\x1bAred"), "\x1b[41m\x1bAred\x1b[49m",
"Nested Background: Trap Type 1 - Not a Style Before"
);
a(
t.bgRed("red\x1bA"), "\x1b[41mred\x1bA\x1b[49m",
"Nested Background: Trap Type 2 - Not a Style After"
);
a(
t.bgRed("\x1bAred\x1bA"), "\x1b[41m\x1bAred\x1bA\x1b[49m",
"Nested Background: Trap Type 3 - Not a Style Around"
);
a(
t.bgRed("\x1b44m\x1b39m"), "\x1b[41m\x1b44m\x1b39m\x1b[49m",
"Nested Background: Trap Type 4 - Not a Valid Style"
);
a(
t.bgRed("\x1b[44m\x1b[49m"), "\x1b[41m\x1b[44m\x1b[41m\x1b[49m",
"Nested Background: Trap Type 5 - No Message Style"
);
a(
t.bgRed("\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m"),
"\x1b[41m\x1b[44m\x1b[41m\x1b[44mblue\x1b[41m\x1b[49m",
"Nested Background: Trap Type 6 - No Message Style Before");
a(t.bgRed("\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m"),
"Nested Background: Trap Type 6 - No Message Style Before"
);
a(
t.bgRed("\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m"),
"\x1b[41m\x1b[44mblue\x1b[41m\x1b[44m\x1b[41m\x1b[49m",
"Nested Background: Trap Type 7 - No Message Style After");
a(t.bgRed("\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m"),
"Nested Background: Trap Type 7 - No Message Style After"
);
a(
t.bgRed("\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m"),
"\x1b[41m\x1b[44m\x1b[41m\x1b[44mblue\x1b[41m\x1b[44m\x1b[41m\x1b[49m",
"Nested Background: Trap Type 8 - No Message Style Around");
"Nested Background: Trap Type 8 - No Message Style Around"
);
a(t.red("red " + t.bgBlue("blue ")),
"\x1b[31mred \x1b[44mblue \x1b[49m\x1b[39m",
"Nested Foreground and Background: Two Levels Type 1");
a(t.red("red " + t.bgBlue("blue ") + t.white("white")),
a(
t.red("red " + t.bgBlue("blue ")), "\x1b[31mred \x1b[44mblue \x1b[49m\x1b[39m",
"Nested Foreground and Background: Two Levels Type 1"
);
a(
t.red("red " + t.bgBlue("blue ") + t.white("white")),
"\x1b[31mred \x1b[44mblue \x1b[49m\x1b[37mwhite\x1b[31m\x1b[39m",
"Nested Foreground and Background: Two Levels Type 2");
a(t.red("red " + t.bgBlue("blue ") + "red"),
"\x1b[31mred \x1b[44mblue \x1b[49mred\x1b[39m",
"Nested Foreground and Background: Two Levels Type 3");
a(t.bgBlue("blue " + t.bgRed("red " + t.whiteBright("white ") + "red ") + "blue"),
"Nested Foreground and Background: Two Levels Type 2"
);
a(
t.red("red " + t.bgBlue("blue ") + "red"), "\x1b[31mred \x1b[44mblue \x1b[49mred\x1b[39m",
"Nested Foreground and Background: Two Levels Type 3"
);
a(
t.bgBlue("blue " + t.bgRed("red " + t.whiteBright("white ") + "red ") + "blue"),
"\x1b[44mblue \x1b[41mred \x1b[97mwhite \x1b[39mred \x1b[44mblue\x1b[49m",
"Nested Foreground and Background: Two Levels Type 3");
"Nested Foreground and Background: Two Levels Type 3"
);
a(t.red.bgWhite("white " + t.bgBlue("blue")),
a(
t.red.bgWhite("white " + t.bgBlue("blue")),
"\x1b[47m\x1b[31mwhite \x1b[44mblue\x1b[47m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Mixed Type 1");
a(t.red.bgWhite("white " + t.blue("blue")),
"Nested Foreground and Background: Mixed Type 1"
);
a(
t.red.bgWhite("white " + t.blue("blue")),
"\x1b[47m\x1b[31mwhite \x1b[34mblue\x1b[31m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Mixed Type 2");
a(t.red.bgWhite("white " + t.blue("blue ") + "white"),
"Nested Foreground and Background: Mixed Type 2"
);
a(
t.red.bgWhite("white " + t.blue("blue ") + "white"),
"\x1b[47m\x1b[31mwhite \x1b[34mblue \x1b[31mwhite\x1b[39m\x1b[49m",
"Nested Foreground and Background: Mixed Type 3");
"Nested Foreground and Background: Mixed Type 3"
);
a(t.red.bgWhite("\x1bAred"),
"\x1b[47m\x1b[31m\x1bAred\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 1 - Not a Style Before");
a(t.red.bgWhite("red\x1bA"),
"\x1b[47m\x1b[31mred\x1bA\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 2 - Not a Style After");
a(t.red.bgWhite("\x1bAred\x1bA"),
"\x1b[47m\x1b[31m\x1bAred\x1bA\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 3 - Not a Style Around");
a(t.red.bgWhite("\x1b34m\x1b39m"),
"\x1b[47m\x1b[31m\x1b34m\x1b39m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 4 - Not a Valid Style");
a(t.red.bgWhite("\x1b[34m\x1b[39m"),
"\x1b[47m\x1b[31m\x1b[34m\x1b[31m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 5 - No Message Style");
a(t.red.bgWhite("\x1b[44m\x1b[49m"),
"\x1b[47m\x1b[31m\x1b[44m\x1b[47m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 6 - No Message Style");
a(t.red.bgWhite("\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m"),
a(
t.red.bgWhite("\x1bAred"), "\x1b[47m\x1b[31m\x1bAred\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 1 - Not a Style Before"
);
a(
t.red.bgWhite("red\x1bA"), "\x1b[47m\x1b[31mred\x1bA\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 2 - Not a Style After"
);
a(
t.red.bgWhite("\x1bAred\x1bA"), "\x1b[47m\x1b[31m\x1bAred\x1bA\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 3 - Not a Style Around"
);
a(
t.red.bgWhite("\x1b34m\x1b39m"), "\x1b[47m\x1b[31m\x1b34m\x1b39m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 4 - Not a Valid Style"
);
a(
t.red.bgWhite("\x1b[34m\x1b[39m"), "\x1b[47m\x1b[31m\x1b[34m\x1b[31m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 5 - No Message Style"
);
a(
t.red.bgWhite("\x1b[44m\x1b[49m"), "\x1b[47m\x1b[31m\x1b[44m\x1b[47m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 6 - No Message Style"
);
a(
t.red.bgWhite("\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m"),
"\x1b[47m\x1b[31m\x1b[44m\x1b[47m\x1b[44mblue\x1b[47m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 7 - No Message Style Before");
a(t.red.bgWhite("\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m"),
"Nested Foreground and Background: Trap Type 7 - No Message Style Before"
);
a(
t.red.bgWhite("\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m"),
"\x1b[47m\x1b[31m\x1b[44mblue\x1b[47m\x1b[44m\x1b[47m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 8 - No Message Style After");
a(t.red.bgWhite("\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m"),
"Nested Foreground and Background: Trap Type 8 - No Message Style After"
);
a(
t.red.bgWhite("\x1b[44m\x1b[49m\x1b[44mblue\x1b[49m\x1b[44m\x1b[49m"),
"\x1b[47m\x1b[31m\x1b[44m\x1b[47m\x1b[44mblue\x1b[47m\x1b[44m\x1b[47m\x1b[39m\x1b[49m",
"Nested Foreground and Background: Trap Type 9 - No Message Style Around");
"Nested Foreground and Background: Trap Type 9 - No Message Style Around"
);

@@ -268,20 +379,32 @@ x = t.red;

a(x("foo", "red") + " " + y("foo", "boldred"),
"\x1b[31mfoo red\x1b[39m \x1b[1m\x1b[31mfoo boldred\x1b[39m\x1b[22m",
"Detached extension");
a(
x("foo", "red") + " " + y("foo", "boldred"),
"\x1b[31mfoo red\x1b[39m \x1b[1m\x1b[31mfoo boldred\x1b[39m\x1b[22m", "Detached extension"
);
if (t.xtermSupported) {
a(t.xterm(12).bgXterm(67)("foo", "xterm"),
"\x1b[48;5;67m\x1b[38;5;12mfoo xterm\x1b[39m\x1b[49m", "Xterm");
a(
t.xterm(12).bgXterm(67)("foo", "xterm"),
"\x1b[48;5;67m\x1b[38;5;12mfoo xterm\x1b[39m\x1b[49m", "Xterm"
);
a(t.redBright.bgBlueBright.xterm(12).bgXterm(67)("foo", "xterm"),
"\x1b[48;5;67m\x1b[38;5;12mfoo xterm\x1b[39m\x1b[49m",
"Xterm: Override & Bright");
a(t.xterm(12).bgXterm(67).redBright.bgMagentaBright("foo", "xterm"),
"\x1b[105m\x1b[91mfoo xterm\x1b[39m\x1b[49m",
"Xterm: Override & Bright #2");
a(
t.redBright.bgBlueBright.xterm(12).bgXterm(67)("foo", "xterm"),
"\x1b[48;5;67m\x1b[38;5;12mfoo xterm\x1b[39m\x1b[49m", "Xterm: Override & Bright"
);
a(
t.xterm(12).bgXterm(67).redBright.bgMagentaBright("foo", "xterm"),
"\x1b[105m\x1b[91mfoo xterm\x1b[39m\x1b[49m", "Xterm: Override & Bright #2"
);
} else {
a(t.xterm(12).bgXterm(67)("foo", "xterm"),
"\x1b[100m\x1b[94mfoo xterm\x1b[39m\x1b[49m", "Xterm");
a(
t.xterm(12).bgXterm(67)("foo", "xterm"), "\x1b[100m\x1b[94mfoo xterm\x1b[39m\x1b[49m",
"Xterm"
);
}
};
supportsColor.disableColor();
a(t.red("foo"), "foo", "Foreground with NO_COLOR");
a(t.bgRed("foo", "bar"), "foo bar", "Background with NO_COLOR");
a(t.blue.bgYellow("foo", "bar"), "foo bar", "Foreground & Background with NO_COLOR");
});

@@ -14,4 +14,6 @@ "use strict";

a(length("\x1b[31mABC\x1b[3mDE\x1b[23m\x1b[39m"), 5, "Works on nested formatted string");
a(length("\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m"), 9,
"Works on nested formatted string with overlapping styles");
a(
length("\x1b[31mAAA\x1b[32mBBB\x1b[31mAAA\x1b[39m"), 9,
"Works on nested formatted string with overlapping styles"
);
};

@@ -7,5 +7,3 @@ "use strict";

a(t.length, 256, "Length");
t.forEach(function (data, index) {
a(re.test(data), true, "In range #" + index);
});
t.forEach(function (data, index) { a(re.test(data), true, "In range #" + index); });
};

@@ -6,5 +6,4 @@ "use strict";

t.forEach(function (data, index) {
a(((data >= 30) && (data <= 37)) || ((data >= 90) && (data <= 97)), true,
"In range #" + index);
a((data >= 30 && data <= 37) || (data >= 90 && data <= 97), true, "In range #" + index);
});
};
"use strict";
module.exports = function (t, a) {
a(typeof t, "string");
};
module.exports = function (t, a) { a(typeof t, "string"); };

@@ -6,4 +6,3 @@ "use strict";

module.exports = function (t, a) {
var x = clc.red
, y = x.bold;
var x = clc.red, y = x.bold;

@@ -28,5 +27,6 @@ a(t("test"), "test", "Plain");

a(t(clc.blue.bgYellow("foo", "bar")), "foo bar", "Foreground & Background");
a(t(clc.blue.bgYellow.red.bgMagenta("foo", "bar")),
"foo bar",
"Foreground & Background: Overriden");
a(
t(clc.blue.bgYellow.red.bgMagenta("foo", "bar")), "foo bar",
"Foreground & Background: Overriden"
);

@@ -40,5 +40,6 @@ a(t(clc.bold("foo", "bar")), "foo bar", "Format");

a(t(clc.blueBright.bgYellowBright.red.bgMagenta("foo", "bar")),
"foo bar",
"Foreground & Background: Bright: Overriden");
a(
t(clc.blueBright.bgYellowBright.red.bgMagenta("foo", "bar")), "foo bar",
"Foreground & Background: Bright: Overriden"
);

@@ -51,12 +52,12 @@ a(t(clc.red.blue("foo")), "foo", "Prioritize the Last Color: Blue");

a(t(clc.bgBlue.blue.bgRed.red("foo")), "foo", "Prioritize the Last Mixed Style: Red");
a(t(clc.bgRed.blue.bgBlue.red("foo")),
"foo",
"Prioritize the Last Mixed Style: BG Blue and Red");
a(t(clc.bgBlue.red.bgRed.blue("foo")),
"foo",
"Prioritize the Last Mixed Style: BG Red and Blue");
a(
t(clc.bgRed.blue.bgBlue.red("foo")), "foo",
"Prioritize the Last Mixed Style: BG Blue and Red"
);
a(
t(clc.bgBlue.red.bgRed.blue("foo")), "foo",
"Prioritize the Last Mixed Style: BG Red and Blue"
);
a(t(x("foo", "red") + " " + y("foo", "boldred")),
"foo red foo boldred",
"Detached extension");
a(t(x("foo", "red") + " " + y("foo", "boldred")), "foo red foo boldred", "Detached extension");

@@ -63,0 +64,0 @@ a(t(clc.erase.screen).replace(/\n/g, ""), "", "Reset");

@@ -29,10 +29,15 @@ "use strict";

a.ok(out.length > 4, "Interval");
a(
startsWith.call(
out.join(""),
"START\x1b[31m-\x1b[39m\x1b[31m\b\\\x1b" +
"[39m\x1b[31m\b|\x1b[39m\x1b[31m\b/\x1b[39m\x1b[31m\b-\x1b[39m"
),
true, "Output"
);
var isNoColor = Boolean(process.env.NO_COLOR);
if (isNoColor) {
a(startsWith.call(out.join(""), "START"), true, "Output");
} else {
a(
startsWith.call(
out.join(""),
"START\x1b[31m-\x1b[39m\x1b[31m\b\\\x1b" +
"[39m\x1b[31m\b|\x1b[39m\x1b[31m\b/\x1b[39m\x1b[31m\b-\x1b[39m"
),
true, "Output"
);
}
a(err, "", "No stderr output");

@@ -39,0 +44,0 @@ d();

@@ -19,3 +19,3 @@ "use strict";

if (!this.running) this.running = true;
return str + chars[this.index = (this.index + 1) % l];
return str + chars[(this.index = (this.index + 1) % l)];
}),

@@ -22,0 +22,0 @@ reset: d(function () {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc