a super tiny chalk fork
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-30 13:08:39 +02:00
.github fix .github/README.md 2026-05-09 19:34:57 +02:00
.gitignore init 2019-09-12 17:55:26 +08:00
CHANGELOG.md changelog: update 2026-02-09 20:00:58 +01:00
index.d.ts fix types 2026-07-30 13:08:34 +02:00
index.js recover support for number as input 2026-07-30 12:14:12 +02:00
jsconfig.json add Typescript types with JSDoc comments 2023-04-21 21:22:51 +02:00
package-lock.json 4.0.4 2026-07-30 13:08:39 +02:00
package.json 4.0.4 2026-07-30 13:08:39 +02:00
README.md refactor as a wrapper around NodeJS util.styleText function 2026-02-09 20:00:51 +01:00
test.js refactor as a wrapper around NodeJS util.styleText function 2026-02-09 20:00:51 +01:00

tiny-chalk

A super tiny version of chalk, loading in ~1ms instead of ~10ms for chalk (YMMV)

This is convenient when you are in a controlled environment (that is that you don't need all the supports-color detection chalk provides)

[2026 update]: YOU MIGHT NOT NEED SUCH A THIS LIBRARY, since as of v20.12.0, NodeJS has a util.styleText function. tiny-chalk is now just a convenience wrapper around util.styleText.

Install

# To import from ES module in NodeJS
npm install tiny-chalk

# To import from ES module in other JS environment without access to node:util styleText function
npm install tiny-chalk@3

# To import from CommonJS
npm install tiny-chalk@v2

Usage

import { red, bold, bgBlack } from 'tiny-chalk'

console.log(red('Hello world!'))
console.log(bold(bgBlack(red('Hello world again!'))))

Supported styles and colors

Everything that can be found in util.inspect.colors, plus aliases for gray and bgGray as grey and bgGrey:

// style
reset
bold
dim
italic
underline
blink
inverse
hidden
strikethrough
doubleunderline
framed
overlined

// front color
black
red
green
yellow
blue
magenta
cyan
white
gray
grey
redBright
greenBright
yellowBright
blueBright
magentaBright
cyanBright
whiteBright

// background color
bgBlack
bgRed
bgGreen
bgYellow
bgBlue
bgMagenta
bgCyan
bgWhite
bgGray
bgGrey
bgRedBright
bgGreenBright
bgYellowBright
bgBlueBright
bgMagentaBright
bgCyanBright
bgWhiteBright