Colorette
Easily set the color and style of text in the terminal.
No wonky prototype method-chain API.
Automatic color support detection.
Up to 2x faster than alternatives.
NO_COLOR
friendly. 👌
Here's the first example to get you started.
Here's an example using template literals.
Of course, you can nest styles without breaking existing color sequences.
Feeling adventurous? Try the pipeline operator.
Installation
API
<style>(string)
<style>(string)
See supported styles.
options.enabled
options.enabled
Colorette automatically detects if your terminal can display color, but you can toggle color as needed.
You can also force the use of color globally by setting FORCE_COLOR=
or NO_COLOR=
from the CLI.
Supported styles
Colors | Background Colors | Bright Colors | Bright Background Colors | Modifiers |
---|---|---|---|---|
black | bgBlack | blackBright | bgBlackBright | dim |
red | bgRed | redBright | bgRedBright | bold |
green | bgGreen | greenBright | bgGreenBright | hidden |
yellow | bgYellow | yellowBright | bgYellowBright | italic |
blue | bgBlue | blueBright | bgBlueBright | underline |
magenta | bgMagenta | magentaBright | bgMagentaBright |
|
cyan | bgCyan | cyanBright | bgCyanBright | reset |
white | bgWhite | whiteBright | bgWhiteBright | |
gray |
Benchmarks
License
Last updated