ansi-colors
Last updated
Last updated
Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in replacement for chalk, kleur and turbocolor (without the dependencies and rendering bugs).
Please consider following this project's author, Brian Woodward, and consider starring the project to show your ❤️ and support.
Install with npm:
ansi-colors is the fastest Node.js library for terminal styling. A more performant drop-in replacement for chalk, with no dependencies.
Blazing fast - Fastest terminal styling library in node.js, 10-20x faster than chalk!
Drop-in replacement for chalk.
No dependencies (Chalk has 7 dependencies in its tree!)
Safe - Does not modify the String.prototype
like colors.
Supports nested colors, and does not have the nested styling bug that is present in colorette, chalk, and kleur.
Supports chained colors.
Toggle color support on or off.
ansi-colors
does not have the nested styling bug found in colorette, chalk, and kleur.
Results in the following
(sans icons and labels)
Easily enable/disable colors.
Use the .unstyle
method to strip ANSI codes from a string.
Note that bright and bright-background colors are not always supported.
Colors | Background Colors | Bright Colors | Bright Background Colors |
---|---|---|---|
black | bgBlack | blackBright | bgBlackBright |
red | bgRed | redBright | bgRedBright |
green | bgGreen | greenBright | bgGreenBright |
yellow | bgYellow | yellowBright | bgYellowBright |
blue | bgBlue | blueBright | bgBlueBright |
magenta | bgMagenta | magentaBright | bgMagentaBright |
cyan | bgCyan | cyanBright | bgCyanBright |
white | bgWhite | whiteBright | bgWhiteBright |
gray | |||
grey |
(gray
is the U.S. spelling, grey
is more commonly used in the Canada and U.K.)
dim
bold
hidden
italic
underline
inverse
strikethrough
reset
Libraries tested
ansi-colors v3.0.4
chalk v2.4.1
MacBook Pro, Intel Core i7, 2.3 GHz, 16 GB.
Load time
Time it takes to load the first time require()
is called:
ansi-colors - 1.915ms
chalk - 12.437ms
Benchmarks
Windows 10, Intel Core i7-7700k CPU @ 4.2 GHz, 32 GB
Load time
Time it takes to load the first time require()
is called:
ansi-colors - 1.494ms
chalk - 11.523ms
Benchmarks
You might also be interested in these projects:
strip-color: Strip ANSI color codes from a string. No dependencies. | homepage
Commits | Contributor |
42 | |
38 | |
6 | |
2 | |
1 | |
1 | |
1 | |
1 |
Brian Woodward
Please consider supporting me on Patreon, or start your own Patreon page!
Copyright © 2019, Brian Woodward. Released under the MIT License.
This file was generated by verb-generate-readme, v0.8.0, on March 03, 2019.