yoctocolors 🌈
The smallest and fastest command-line coloring package on the internet. Trust me.
The only thing that matters is micro-benchmark performance! ⚡️
Check out Chalk if you want something more mature and comprehensive.
- 4x faster and 5x smaller than nanocolors
- Cat friendly
- An additional color
- Tree-shakeable, not stirred
- Actively maintained (at least for another week)
- No dependencies
npm install yoctocolors
import * as colors from 'yoctocolors';
console.log(colors.red('Yo!'));
This package does not do color support detection. Check out supports-color
if you need that. Node.js will hopefully get built-in support for color support detection at some point.
reset
- Reset the current style.bold
- Make the text bold.dim
- Make the text have lower opacity.italic
- Make the text italic. (Not widely supported)underline
- Put a horizontal line above the text. (Not widely supported)overline
- Put a horizontal line below the text. (Not widely supported)inverse
- Invert background and foreground colors.hidden
- Print the text but make it invisible.strikethrough
- Put a horizontal line through the center of the text. (Not widely supported)
black
red
green
yellow
blue
magenta
cyan
white
gray
bgBlack
bgRed
bgGreen
bgYellow
bgBlue
bgMagenta
bgCyan
bgWhite
bgGray
Yes
❯ ./test/simple-benchmark.js
nanocolors 31508276 ops/sec
picocolors 32524769 ops/sec
yoctocolors 132894792 ops/sec
Benchmark from nanocolors
See this discussion.
It's the smallest official unit prefix in the metric system. Much smaller than nano.
- yoctodelay - Delay a promise a given amount of time
- chalk - Terminal string styling