Comparing version 1.3.3 to 1.3.4-alpha.0
{ | ||
"name": "ansis", | ||
"version": "1.3.3", | ||
"description": "Color styling of text for ANSI terminals.", | ||
"version": "1.3.4-alpha.0", | ||
"description": "ANSI color styling for text in terminal.", | ||
"keywords": [ | ||
"ansi", | ||
"color", | ||
"style", | ||
"color", | ||
"cli", | ||
"console", | ||
"terminal", | ||
"tty", | ||
"xterm", | ||
"rgb", | ||
@@ -42,7 +40,4 @@ "hex", | ||
"type": "module", | ||
"exports": { | ||
"import": "./dist/index.mjs", | ||
"require": "./index.cjs" | ||
}, | ||
"types": "src/index.d.ts", | ||
"module": "./dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
@@ -57,8 +52,3 @@ "demo": "node ./examples/index.js", | ||
"files": [ | ||
"dist", | ||
"src/index.d.ts", | ||
"index.cjs", | ||
"CHANGELOG.md", | ||
"README.md", | ||
"LICENSE" | ||
"dist" | ||
], | ||
@@ -74,4 +64,7 @@ "engines": { | ||
"prettier": "^2.5.1", | ||
"rollup": "^2.66.0" | ||
"rollup": "^2.66.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-copy": "^3.4.0", | ||
"rollup-plugin-cleanup": "^3.2.1" | ||
} | ||
} |
@@ -14,5 +14,8 @@ <h1 align="center"> | ||
This is a Node.js library for coloring output in ANSI terminals.\ | ||
The ansis use the SGR (Select Graphic Rendition) codes defined in the [ECMA-48](https://www.ecma-international.org/publications-and-standards/standards/ecma-48/) standard. | ||
This is a Node.js library for coloring text in terminal.\ | ||
The ansis use the SGR (Select Graphic Rendition) codes defined in the [ECMA-48](https://www.ecma-international.org/publications-and-standards/standards/ecma-48/) standard.\ | ||
**Why yet one lib?** See [comparison of most popular ANSI colors libraries](https://github.com/webdiscus/ansis#compare-most-popular-ansi-libraries) | ||
and [benchmark](https://github.com/webdiscus/ansis#benchmark). | ||
<div align="center"> | ||
@@ -46,3 +49,3 @@ <a href="https://www.npmjs.com/package/ansis"> | ||
- supports both `ESM` and `CommonJS` | ||
- standard API compatible with many popular ANSI libraries | ||
- standard API compatible with many popular ANSI color libraries | ||
- chained syntax | ||
@@ -198,15 +201,15 @@ - nested syntax | ||
<a id="compare" href="#compare"></a> | ||
## Compare most popular ANSI libraries | ||
## Comparison of most popular libraries | ||
| Library | Standard<br>style / color<br>naming | Chain<br>styles | Nested<br>styles | New<br>Line | ANSI 256<br>color<br>methods | Truecolor<br>RGB / HEX<br>methods | Supports<br>NO_COLOR | | ||
|------------------------------|:-----------------------------------:|:---------------:|:----------------:|:-----------:|----------------------------------------------|-----------------------------------|:---------------------------------------------------| | ||
| [`colors.js`][colors.js] | no, e.g.<br>`brightRed`<br>(16 colors) | yes | yes | yes | - | - | only<br>`FORCE_COLOR`<br>`--no-color`<br>`--color` | | ||
| [`colorette`][colorette] | yes<br>(16 colors) | - | yes | - | - | - | yes | | ||
| [`picocolors`][picocolors] | yes<br>(8 colors) | - | yes | - | - | - | yes | | ||
| [`cli-color`][cli-color] | yes<br>(16 colors) | yes | yes | - | `.xterm(num)` | - | yes | | ||
| [`color-cli`][color-cli] | no, e.g.<br>`red_bbt`<br>(16 colors) | yes | _buggy_ | yes | `.x<num>` | - | only<br>`--no-color`<br>`--color` | | ||
| [`ansi-colors`][ansi-colors] | yes<br>(16 colors) | yes | yes | yes | - | - | only<br>`FORCE_COLOR` | | ||
| [`kleur`][kleur] | yes<br>(8 colors) | _yes_* | yes | - | - | - | yes | | ||
| [`chalk`][chalk] | yes<br>(16 colors) | yes | yes | yes | `.ansi256(num)` | `.hex()` `.rgb()` | yes | | ||
| [`ansis`][ansis-github] | yes<br>(16 colors) | yes | yes | yes | `.ansi256(num)`<br>`.ansi(num)`<br>.`fg(num)` | `.hex()` `.rgb()` | yes | | ||
| Library | Standard<br>style / color<br>naming | Chained<br>styles | Nested<br>styles | New<br>Line | ANSI 256<br>colors<br>methods | Truecolor<br>methods | Supports<br>NO_COLOR | | ||
|------------------------------|:-----------------------------------:|:-----------------:|:----------------:|:-----------:|-----------------------------------------------|-----------------------------------|:---------------------------------------------------| | ||
| [`colors.js`][colors.js] | no, e.g.<br>`brightRed`<br>(16 colors) | yes | yes | yes | - | - | only<br>`FORCE_COLOR`<br>`--no-color`<br>`--color` | | ||
| [`colorette`][colorette] | yes<br>(16 colors) | - | yes | - | - | - | yes | | ||
| [`picocolors`][picocolors] | yes<br>(8 colors) | - | yes | - | - | - | yes | | ||
| [`cli-color`][cli-color] | yes<br>(16 colors) | yes | yes | - | `.xterm(num)` | - | yes | | ||
| [`color-cli`][color-cli] | no, e.g.<br>`red_bbt`<br>(16 colors) | yes | _buggy_ | yes | `.x<num>` | - | only<br>`--no-color`<br>`--color` | | ||
| [`ansi-colors`][ansi-colors] | yes<br>(16 colors) | yes | yes | yes | - | - | only<br>`FORCE_COLOR` | | ||
| [`kleur`][kleur] | yes<br>(8 colors) | _yes_* | yes | - | - | - | yes | | ||
| [`chalk`][chalk] | yes<br>(16 colors) | yes | yes | yes | `.ansi256(num)` | `.hex()` `.rgb()` | yes | | ||
| [`ansis`][ansis-github] | yes<br>(16 colors) | yes | yes | yes | `.ansi256(num)`<br>`.ansi(num)`<br>.`fg(num)` | `.hex()` `.rgb()` | yes | | ||
@@ -263,3 +266,3 @@ ### Column description | ||
```diff | ||
colors-js 1,158,572 ops/sec | ||
colors.js 1,158,572 ops/sec | ||
colorette 4,572,582 ops/sec | ||
@@ -276,17 +279,18 @@ picocolors 3,841,124 ops/sec | ||
### Base styles | ||
### Base colors | ||
```js | ||
styles.forEach((style) => c[style]('foo')); | ||
const colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']; | ||
colors.forEach((color) => c[color]('foo')); | ||
``` | ||
```diff | ||
colors-js 471,395 ops/sec | ||
colorette 1,103,314 ops/sec | ||
picocolors 5,725,578 ops/sec | ||
cli-color 221,282 ops/sec | ||
color-cli 73,725 ops/sec | ||
ansi-colors 716,280 ops/sec | ||
kleur/colors 1,259,858 ops/sec | ||
kleur 3,829,838 ops/sec | ||
chalk 3,165,933 ops/sec | ||
+ ansis 4,483,217 ops/sec | ||
colors.js 640,101 ops/sec | ||
colorette 1,874,506 ops/sec | ||
picocolors 8,265,628 ops/sec | ||
cli-color 305,690 ops/sec | ||
color-cli 104,962 ops/sec | ||
ansi-colors 1,010,628 ops/sec | ||
kleur/colors 2,074,111 ops/sec | ||
kleur 5,455,121 ops/sec | ||
chalk 4,428,884 ops/sec | ||
+ ansis 6,197,754 ops/sec | ||
``` | ||
@@ -299,12 +303,12 @@ | ||
```diff | ||
colors-js 138,219 | ||
colorette (not supported) | ||
picocolors (not supported) | ||
cli-color 144,837 | ||
color-cli 52,732 | ||
ansi-colors 158,921 | ||
kleur/colors (not supported) | ||
kleur 514,035 | ||
chalk 1,234,573 | ||
+ ansis 5,515,868 | ||
colors.js 138,219 ops/sec | ||
colorette (not supported) | ||
picocolors (not supported) | ||
cli-color 144,837 ops/sec | ||
color-cli 52,732 ops/sec | ||
ansi-colors 158,921 ops/sec | ||
kleur/colors (not supported) | ||
kleur 514,035 ops/sec | ||
chalk 1,234,573 ops/sec | ||
+ ansis 5,515,868 ops/sec | ||
@@ -318,3 +322,3 @@ ``` | ||
```diff | ||
colors-js 166,425 ops/sec | ||
colors.js 166,425 ops/sec | ||
colorette 695,350 ops/sec | ||
@@ -337,3 +341,3 @@ picocolors 942,592 ops/sec | ||
```diff | ||
colors-js 89,633 ops/sec | ||
colors.js 89,633 ops/sec | ||
colorette 243,139 ops/sec | ||
@@ -370,3 +374,3 @@ picocolors 243,975 ops/sec | ||
```diff | ||
colors-js 451,592 ops/sec | ||
colors.js 451,592 ops/sec | ||
colorette 1,131,757 ops/sec | ||
@@ -390,3 +394,3 @@ picocolors 1,002,649 ops/sec | ||
```diff | ||
colors-js (not supported) | ||
colors.js (not supported) | ||
colorette (not supported) | ||
@@ -393,0 +397,0 @@ picocolors (not supported) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
427
27040
9
6
192
1
1
1