jorgebucaran / Colorette
Licence: mit
Easily set the color and style of text in the terminal.
Stars: ✭ 1,047
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Colorette
Termenv
Advanced ANSI style & color support for your terminal applications
Stars: ✭ 555 (-46.99%)
Mutual labels: terminal, console, ansi, colors
Asciichart
Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies
Stars: ✭ 1,107 (+5.73%)
Mutual labels: terminal, console, ansi, browser
Rang
A Minimal, Header only Modern c++ library for terminal goodies 💄✨
Stars: ✭ 1,080 (+3.15%)
Mutual labels: cli, terminal, console, ansi
Colorful
Terminal string styling done right, in Python 🐍 🎉
Stars: ✭ 456 (-56.45%)
Mutual labels: terminal, console, ansi, colors
Chalk
🖍 Terminal string styling done right
Stars: ✭ 17,566 (+1577.75%)
Mutual labels: cli, terminal, console, ansi
Wonders
🌈 Declarative JavaScript framework to build command-line applications.
Stars: ✭ 34 (-96.75%)
Mutual labels: cli, terminal, console
Termcolor
Termcolor is a header-only C++ library for printing colored messages to the terminal. Written just for fun with a help of the Force.
Stars: ✭ 533 (-49.09%)
Mutual labels: terminal, console, colors
Video To Ascii
It is a simple python package to play videos in the terminal using characters as pixels
Stars: ✭ 960 (-8.31%)
Mutual labels: cli, terminal, console
Progressbar
Terminal-based progress bar for Java / JVM
Stars: ✭ 625 (-40.31%)
Mutual labels: cli, terminal, console
Tml
🌈💻🎨 A tiny markup language for terminal output. Makes formatting output in CLI apps easier!
Stars: ✭ 634 (-39.45%)
Mutual labels: cli, terminal, colors
Termtools
Customize your terminal using JavaScript. With themes, extra alias and functions, we combine the power from both JavaScript and Bash.
Stars: ✭ 42 (-95.99%)
Mutual labels: cli, terminal, console
Pulsemixer
CLI and curses mixer for PulseAudio
Stars: ✭ 441 (-57.88%)
Mutual labels: cli, terminal, console
Langterm
🕹️ WebGL-based VT220 emulator, made as a learning example and frontend for a text adventure
Stars: ✭ 35 (-96.66%)
Mutual labels: cli, terminal, console
Yaspin
A lightweight terminal spinner for Python with safe pipes and redirects 🎁
Stars: ✭ 413 (-60.55%)
Mutual labels: cli, terminal, console
Mordant
Full-featured text styling for Kotlin command-line applications
Stars: ✭ 382 (-63.51%)
Mutual labels: terminal, console, ansi
Chafa
📺🗿 Terminal graphics for the 21st century.
Stars: ✭ 774 (-26.07%)
Mutual labels: cli, terminal, ansi
Pixterm
Draw images in your ANSI terminal with true color
Stars: ✭ 782 (-25.31%)
Mutual labels: cli, terminal, ansi
Tui Consolelauncher
Linux CLI Launcher for Android
Stars: ✭ 861 (-17.77%)
Mutual labels: cli, terminal, console
Hues
Colored terminal text made easy for Python and happiness.
Stars: ✭ 345 (-67.05%)
Mutual labels: cli, terminal, ansi
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.
import { blue, bold, underline } from "colorette"
console.log(
blue("I'm blue"),
bold(blue("da ba dee")),
underline(bold(blue("da ba daa")))
)
Here's an example using template literals.
console.log(`
There's a ${underline(blue("house"))},
With a ${bold(blue("window"))},
And a ${blue("corvette")}
And everything is blue
`)
Of course, you can nest styles without breaking existing color sequences.
console.log(bold(`I'm ${blue(`da ba ${underline("dee")} da ba`)} daa`))
Feeling adventurous? Try the pipeline operator.
console.log("Da ba dee da ba daa" |> blue |> bold)
Installation
npm install colorette
API
<style>(string)
See supported styles.
import { blue } from "colorette"
blue("I'm blue") //=> \x1b[34mI'm blue\x1b[39m
options.enabled
Colorette automatically detects if your terminal can display color, but you can toggle color as needed.
import { options } from "colorette"
options.enabled = false
You can also force the use of color globally by setting FORCE_COLOR=
or NO_COLOR=
from the CLI.
$ FORCE_COLOR= node example.js >log
$ NO_COLOR= node example.js
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
npm --prefix bench start
License
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].