Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
190 lines (162 loc) · 8.21 KB

File metadata and controls

190 lines (162 loc) · 8.21 KB
Copy raw file
Download raw file
Outline
Edit and raw actions

Compare the features of most popular libraries

Library Colors support Features
- ESM | CJS
- named import
- naming colors
16 | 256 | 16m | 🌐 Fallback Chained
syntax
Nested
template
strings
`${}`
LF
\n
Supports
ENV vars
CLI flags
ansis
ESM CJS
✅ named import
✅ standard
✅ ✅ ✅ ✅ →256
→16
→b&w
NO_COLOR
FORCE_COLOR
COLORTERM
--no-color
--color
chalk v5
ESM
❌ named import
✅ standard
✅ ✅ ✅ ✅ →256
→16
→b&w
NO_COLOR
FORCE_COLOR
--no-color
--color
kolorist
ESM CJS
✅ named import
❌ standard
✅ ✅ ✅ ❌ →256
→b&w
NO_COLOR
FORCE_COLOR
cli-color
CJS
❌ named import
✅ standard
✅ ✅ ❌ 🛑 →16
→b&w
NO_COLOR
colors-cli
CJS
❌ named import
❌ standard
✅ ✅ ❌ 🛑 →b&w --no-color
--color
colors.js
CJS
❌ named import
❌ standard
✅ ❌ ❌ 🛑 →b&w FORCE_COLOR
--no-color
--color
ansi-colors
CJS
❌ named import
✅ standard
✅ ❌ ❌ ❌ FORCE_COLOR
colorette
ESM CJS
✅ named import
✅ standard
✅ ❌ ❌ 🛑 →b&w NO_COLOR
FORCE_COLOR
--no-color
--color
picocolors
CJS
❌ named import
✅ standard
✅ ❌ ❌ ❌ →b&w NO_COLOR
FORCE_COLOR
--no-color
--color
tinyrainbow
ESM
❌ named import
✅ standard
✅ ❌ ❌ ✅ →b&w NO_COLOR
FORCE_COLOR
FORCE_TTY
--no-color
--color
kleur
ESM CJS
✅ named import
✅ standard
❌ ❌ ❌ ✅
8 colors
→b&w NO_COLOR
FORCE_COLOR
util.styleText()
Node ≥ 22
❌ named import
✅ standard
✅ ❌ ❌ 🛑 →b&w ? NO_COLOR
FORCE_COLOR

Legend

Named import

  • ESM: import { red, green, blue } from 'lib';
  • CJS: const { red, green, blue } = require('lib');

Naming colors

  • standard: colors have standard names, e.g.: red, redBright, bgRed, bgRedBright
  • non-standard: colors have lib-specific names, e.g.: brightRed, bgBrightRed, red_b, red_btt

Colors support

  • 16 - ANSI 16 colors like red, redBright, bgRed, bgRedBright

  • 256 - ANSI 256 colors methods, e.g.:

    • [ansis][ansis]: fg(n), bg(n)
    • [chalk][chalk]: ansi256(n), bgAnsi256(n)
    • [cli-color][cli-color]: xterm(n)
    • [colors-cli][colors-cli]: x<n>
  • 16m - Truecolor methods, e.g.: hex(), bgHex(), rgb(), bgRgb()

  • 🌐 - Colored output in Chromium-based browser console:

    • ✅ - colored output
    • ❌ - b&w output
    • 🛑 - fatal error by compilation or in runtime
  • Fallback - Truecolor → 256 colors → 16 colors → no colors

Features

  • Chained syntax - lib.red.bold('text')

  • Nested templates - lib.red`text ${lib.cyan`nested`} text`

  • LF - correct style break at \n:

    console.log(bgGreen('\nAnsis\nNew Line\nNext New Line\n'))

    Outputs:
    output

Morty Proxy This is a proxified and sanitized view of the page, visit original site.