Skip to content

Commit

Permalink
chore: replace outdated colors.js with current version @colors/colors
Browse files Browse the repository at this point in the history
  • Loading branch information
webdiscus committed Dec 31, 2024
1 parent adb758f commit 9c3555f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The most popular Node.js libraries similar to Ansis:
- [Correct style break](#new-line) at the `end of line` when used `\n` in string
- Doesn't extend `String.prototype`
- Zero dependencies
- Test coverage 100%. Long term maintenance.
- Test coverage 100%. Long term support.

## 🌍 Used by

Expand Down Expand Up @@ -130,7 +130,7 @@ Only `ansis`, `chalk`, and `picocolors` are actively maintained, unlike many oth
- `kleur`: Last updated [2 years ago][npm-kleur]
- `cli-color`: Last updated [~1 year ago][npm-cli-color]
- `colors-cli`: Last updated [1 year ago][npm-colors-cli]
- `colors.js`: Last updated [5 year ago][npm-colors.js]
- `colors.js`: Last updated [1 year ago][npm-colors.js]


### 🤔 Which One Should You Use?
Expand Down Expand Up @@ -907,18 +907,18 @@ npm run compare
## Compare the size of most popular packages
| Npm package | Download tarball size | Unpacked Size | Code size |
|:-----------------------------|----------------------------------------------------------------------:|-------------------------------:|----------:|
| [`picocolors`][picocolors] | [2.6 kB](https://arve0.github.io/npm-download-size/#picocolors) | [6.4 kB][npm-picocolors] | 2.6 kB
| [`ansis`][ansis] | [3.8 kB](https://arve0.github.io/npm-download-size/#ansis) | [7.0 kB][npm-ansis] | 3.4 kB
| [`colorette`][colorette] | [4.9 kB](https://arve0.github.io/npm-download-size/#colorette) | [17.0 kB][npm-colorette] | 3.4 kB
| [`kleur`][kleur] | [6.0 kB](https://arve0.github.io/npm-download-size/#kleur) | [20.3 kB][npm-kleur] | 2.7 kB
| [`ansi-colors`][ansi-colors] | [8.5 kB](https://arve0.github.io/npm-download-size/#ansi-colors) | [26.1 kB][npm-ansi-colors] | 5.8 kB
| [`kolorist`][kolorist] | [8.7 kB](https://arve0.github.io/npm-download-size/#kolorist) | [51.0 kB][npm-kolorist] | 6.8 kB
| [`colors.js`][colors.js] | [11.0 kB](https://arve0.github.io/npm-download-size/#colors) | [39.5 kB][npm-colors.js] | 18.1 kB
| [`chalk`][chalk] | [13.1 kB](https://arve0.github.io/npm-download-size/#chalk) | [43.7 kB][npm-chalk] | 16.4 kB
| [`cli-color`][cli-color] | [13.8 (216 kB)](https://arve0.github.io/npm-download-size/#cli-color) | [39.6 (754 kB)][npm-cli-color] | 12.1 kB
| [`colors-cli`][colors-cli] | [361.7 kB](https://arve0.github.io/npm-download-size/#colors-cli) | [511.0 kB][npm-colors-cli] | 8.7 kB
| Npm package | Download tarball size | Unpacked Size | Code size |
|:-----------------------------|-----------------------------------------------------------------------:|-------------------------------:|----------:|
| [`picocolors`][picocolors] | [2.6 kB](https://arve0.github.io/npm-download-size/#picocolors) | [6.4 kB][npm-picocolors] | 2.6 kB
| [`ansis`][ansis] | [3.8 kB](https://arve0.github.io/npm-download-size/#ansis) | [7.0 kB][npm-ansis] | 3.4 kB
| [`colorette`][colorette] | [4.9 kB](https://arve0.github.io/npm-download-size/#colorette) | [17.0 kB][npm-colorette] | 3.4 kB
| [`kleur`][kleur] | [6.0 kB](https://arve0.github.io/npm-download-size/#kleur) | [20.3 kB][npm-kleur] | 2.7 kB
| [`ansi-colors`][ansi-colors] | [8.5 kB](https://arve0.github.io/npm-download-size/#ansi-colors) | [26.1 kB][npm-ansi-colors] | 5.8 kB
| [`kolorist`][kolorist] | [8.7 kB](https://arve0.github.io/npm-download-size/#kolorist) | [51.0 kB][npm-kolorist] | 6.8 kB
| [`colors.js`][colors.js] | [11.1 kB](https://arve0.github.io/npm-download-size/#@colors%2fcolors) | [41.5 kB][npm-colors.js] | 18.1 kB
| [`chalk`][chalk] | [13.1 kB](https://arve0.github.io/npm-download-size/#chalk) | [43.7 kB][npm-chalk] | 16.4 kB
| [`cli-color`][cli-color] | [13.8 (216 kB)](https://arve0.github.io/npm-download-size/#cli-color) | [39.6 (754 kB)][npm-cli-color] | 12.1 kB
| [`colors-cli`][colors-cli] | [361.7 kB](https://arve0.github.io/npm-download-size/#colors-cli) | [511.0 kB][npm-colors-cli] | 8.7 kB
**Download size:** The gzipped size of the npm package.\
**Unpacked Size:** The size of the npm package in the `node_modules/` directory, `(incl. dependencies)`.\
Expand Down Expand Up @@ -1449,7 +1449,7 @@ fg(202).bg(236)`Orange text on dark gray background`;

[ISC](https://github.com/webdiscus/ansis/blob/master/LICENSE)

[colors.js]: https://github.com/Marak/colors.js
[colors.js]: https://github.com/DABH/colors.js

[colorette]: https://github.com/jorgebucaran/colorette

Expand All @@ -1469,7 +1469,7 @@ fg(202).bg(236)`Orange text on dark gray background`;

[ansis]: https://github.com/webdiscus/ansis

[npm-colors.js]: https://www.npmjs.com/package/colors
[npm-colors.js]: https://www.npmjs.com/package/@colors/colors

[npm-colorette]: https://www.npmjs.com/package/colorette

Expand Down
20 changes: 10 additions & 10 deletions bench/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Bench from './lib/bench.js';

// vendor libraries
import chalk from 'chalk';
import colorsJs from 'colors';
import colorsJs from '@colors/colors';
import * as colorette from 'colorette';
import ansiColors from 'ansi-colors';
import cliColor from 'cli-color';
Expand Down Expand Up @@ -81,7 +81,7 @@ bench('Simple, using 1 style').
add(packages['kolorist'], () => kolorist.red('foo')).
add(packages['cli-color'], () => cliColor.red('foo')).
add(packages['colors-cli'], () => colorCli.red('foo')).
add(packages['colors'], () => colorsJs.red('foo')).
add(packages['@colors/colors'], () => colorsJs.red('foo')).
run();

// Fastest way for 2 styles
Expand All @@ -95,7 +95,7 @@ bench(`Use 2 styles`).
add(packages['kolorist'], () => kolorist.red(kolorist.bold('foo'))).
add(packages['cli-color'], () => cliColor.red.bold('foo')).
add(packages['colors-cli'], () => colorCli.red.bold('foo')).
add(packages['colors'], () => colorsJs.red.bold('foo')).
add(packages['@colors/colors'], () => colorsJs.red.bold('foo')).
run();

// Fastest way for 3 styles
Expand All @@ -109,7 +109,7 @@ bench('Use 3 styles').
add(packages['kolorist'], () => kolorist.red(kolorist.bold(kolorist.bgWhite('foo')))).
add(packages['cli-color'], () => cliColor.red.bold.bgWhite('foo')).
add(packages['colors-cli'], () => colorCli.red.bold.white_bt('foo')).
add(packages['colors'], () => colorsJs.red.bold.bgWhite('foo')).
add(packages['@colors/colors'], () => colorsJs.red.bold.bgWhite('foo')).
run();

// Fastest way for 4 styles
Expand All @@ -123,7 +123,7 @@ bench('Use 4 styles').
add(packages['kolorist'], () => kolorist.red(kolorist.bold(kolorist.underline(kolorist.bgWhite('foo'))))).
add(packages['cli-color'], () => cliColor.red.bold.underline.bgWhite('foo')).
add(packages['colors-cli'], () => colorCli.red.bold.underline.white_bt('foo')).
add(packages['colors'], () => colorsJs.red.bold.underline.bgWhite('foo')).
add(packages['@colors/colors'], () => colorsJs.red.bold.underline.bgWhite('foo')).
run();

// Chained syntax
Expand All @@ -134,7 +134,7 @@ bench('Chained syntax').
add(packages['ansi-colors'], () => ansiColors.red.bold.underline.bgWhite('foo')).
add(packages['cli-color'], () => cliColor.red.bold.underline.bgWhite('foo')).
add(packages['colors-cli'], () => colorCli.red.bold.underline.white_bt('foo')).
add(packages['colors'], () => colorsJs.red.bold.underline.bgWhite('foo')).
add(packages['@colors/colors'], () => colorsJs.red.bold.underline.bgWhite('foo')).
// colorette - (not supported)
// picocolors - (not supported)
// kolorist - (not supported)
Expand All @@ -151,7 +151,7 @@ bench('Nested styles').
add(packages['kolorist'], () => kolorist.red(kolorist.bold(kolorist.underline(kolorist.bgWhite('foo'))))).
add(packages['cli-color'], () => cliColor.red(cliColor.bold(cliColor.underline(cliColor.bgWhite('foo'))))).
add(packages['colors-cli'], () => colorCli.red(colorCli.bold(colorCli.underline(colorCli.white_bt('foo'))))).
add(packages['colors'], () => colorsJs.red(colorsJs.bold(colorsJs.underline(colorsJs.bgWhite('foo'))))).
add(packages['@colors/colors'], () => colorsJs.red(colorsJs.bold(colorsJs.underline(colorsJs.bgWhite('foo'))))).
run();

// Deep nested styles
Expand All @@ -177,7 +177,7 @@ bench('Deep nested styles').
add(packages['kolorist'], () => deepNestedBench(kolorist)).
add(packages['cli-color'], () => deepNestedBench(cliColor)).
add(packages['colors-cli'], () => deepNestedBench(colorCli)).
add(packages['colors'], () => deepNestedBench(colorsJs)).
add(packages['@colors/colors'], () => deepNestedBench(colorsJs)).
run();

// Colorette bench
Expand All @@ -194,7 +194,7 @@ bench('Colorette bench').
add(packages['kolorist'], () => coloretteBanch(kolorist)).
add(packages['cli-color'], () => coloretteBanch(cliColor)).
add(packages['colors-cli'], () => coloretteBanch(colorCli)).
add(packages['colors'], () => coloretteBanch(colorsJs)).
add(packages['@colors/colors'], () => coloretteBanch(colorsJs)).
run();

// Picocolors complex bench, slightly modified
Expand Down Expand Up @@ -223,7 +223,7 @@ bench('Picocolors complex bench').
add(packages['ansi-colors'], () => ansisComplex(ansiColors)).
add(packages['cli-color'], () => ansisComplex(cliColor)).
add(packages['colors-cli'], () => ansisComplex(colorCli)).
add(packages['colors'], () => ansisComplex(colorsJs)).
add(packages['@colors/colors'], () => ansisComplex(colorsJs)).
run();

// Check support of correct break style at new line
Expand Down
1 change: 1 addition & 0 deletions bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"bench:ansis": "node ./ansis.js"
},
"dependencies": {
"@colors/colors": "1.6.0",
"ansi-colors": "4.1.3",
"ansis": "file:../dist",
"benchmark": "2.1.4",
Expand Down
2 changes: 1 addition & 1 deletion compare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// vendor libraries
import chalk from 'chalk';
import colorsJs from 'colors';
import colorsJs from '@colors/colors';
import * as colorette from 'colorette';
import ansiColors from 'ansi-colors';
import cliColor from 'cli-color';
Expand Down
1 change: 1 addition & 0 deletions compare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"start": "node ./"
},
"dependencies": {
"@colors/colors": "1.6.0",
"ansi-colors": "4.1.3",
"ansis": "file:../dist",
"chalk": "5.3.0",
Expand Down

0 comments on commit 9c3555f

Please sign in to comment.