Installations
npm install @nyxb/picocolors
Developer Guide
Typescript
Yes
Module System
CommonJS, UMD
Node Version
18.16.0
NPM Version
9.5.1
Score
68.5
Supply Chain
98.7
Quality
75.2
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
validate.email 🚀
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Developer
alexeyraspopov
Download Statistics
Total Downloads
1,955
Last Day
1
Last Week
5
Last Month
23
Last Year
438
GitHub Statistics
ISC License
1,482 Stars
89 Commits
46 Forks
10 Watchers
1 Branches
13 Contributors
Updated on Mar 14, 2025
Bundle Size
461.00 B
Minified
307.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.0.2
Package Id
@nyxb/picocolors@1.0.2
Unpacked Size
13.40 kB
Size
4.16 kB
File Count
8
NPM Version
9.5.1
Node Version
18.16.0
Published on
May 13, 2023
Total Downloads
Cumulative downloads
Total Downloads
1,955
Last Day
0%
1
Compared to previous day
Last Week
-16.7%
5
Compared to previous week
Last Month
-42.5%
23
Compared to previous month
Last Year
-71.1%
438
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
picocolors
The tiniest and the fastest library for terminal output formatting with ANSI colors.
1import pc from "picocolors" 2 3console.log( 4 pc.green(`How are ${pc.italic(`you`)} doing?`) 5)
- No dependencies.
- 14 times smaller and 2 times faster than chalk.
- Used by popular tools like PostCSS, SVGO, Stylelint, and Browserslist.
- Node.js v6+ & browsers support. Support for both CJS and ESM projects.
- TypeScript type declarations included.
NO_COLOR
friendly.
Motivation
With picocolors
we are trying to draw attention to the node_modules
size
problem and promote performance-first culture.
Prior Art
Credits go to the following projects:
- Nanocolors by @ai
- Colorette by @jorgebucaran
- Kleur by @lukeed
- Colors.js by @Marak
- Chalk by @sindresorhus
Benchmarks
The space in node_modules including sub-dependencies:
1$ node ./benchmarks/size.js 2Data from packagephobia.com 3 chalk 101 kB 4 cli-color 1249 kB 5 ansi-colors 25 kB 6 kleur 21 kB 7 colorette 17 kB 8 nanocolors 16 kB 9+ picocolors 7 kB
Library loading time:
1$ node ./benchmarks/loading.js 2 chalk 6.167 ms 3 cli-color 31.431 ms 4 ansi-colors 1.585 ms 5 kleur 2.008 ms 6 kleur/colors 0.773 ms 7 colorette 2.476 ms 8 nanocolors 0.833 ms 9+ picocolors 0.466 ms
Benchmark for simple use case:
1$ node ./benchmarks/simple.js 2 chalk 24,066,342 ops/sec 3 cli-color 938,700 ops/sec 4 ansi-colors 4,532,542 ops/sec 5 kleur 20,343,122 ops/sec 6 kleur/colors 35,415,770 ops/sec 7 colorette 34,244,834 ops/sec 8 nanocolors 33,443,265 ops/sec 9+ picocolors 33,271,645 ops/sec
Benchmark for complex use cases:
1$ node ./benchmarks/complex.js 2 chalk 969,915 ops/sec 3 cli-color 131,639 ops/sec 4 ansi-colors 342,250 ops/sec 5 kleur 611,880 ops/sec 6 kleur/colors 1,129,526 ops/sec 7 colorette 1,747,277 ops/sec 8 nanocolors 1,251,312 ops/sec 9+ picocolors 2,024,086 ops/sec
Usage
Picocolors provides an object which includes a variety of text coloring and formatting functions
1import pc from "picocolors"
The object includes following coloring functions: black
, red
, green
, yellow
, blue
, magenta
, cyan
, white
, gray
.
1console.log(`I see a ${pc.red("red door")} and I want it painted ${pc.black("black")}`)
The object also includes following background color modifier functions: bgBlack
, bgRed
, bgGreen
, bgYellow
, bgBlue
, bgMagenta
, bgCyan
, bgWhite
.
1console.log( 2 pc.bgBlack( 3 pc.white(`Tom appeared on the sidewalk with a bucket of whitewash and a long-handled brush.`) 4 ) 5)
Besides colors, the object includes following formatting functions: dim
, bold
, hidden
, italic
, underline
, strikethrough
, reset
, inverse
.
1for (let task of tasks) { 2 console.log(`${pc.bold(task.name)} ${pc.dim(task.durationMs + "ms")}`) 3}
The library provides additional utilities to ensure the best results for the task:
-
isColorSupported
— boolean, explicitly tells whether or not the colors or formatting appear on the screen1import pc from "picocolors" 2 3if (pc.isColorSupported) { 4 console.log("Yay! This script can use colors and formatters") 5}
-
createColors(enabled)
— a function that returns a new API object with manually defined color support configuration1import pc from "picocolors" 2 3let { red, bgWhite } = pc.createColors(options.enableColors)
Replacing chalk
-
Replace package name in import:
1- import chalk from 'chalk' 2+ import pico from 'picocolors'
-
Replace variable:
1- chalk.red(text) 2+ pico.red(text)
-
Replace chains to nested calls:
1- chalk.red.bold(text) 2+ pico.red(pico.bold(text))
-
You can use
colorize-template
to replace chalk’s tagged template literal.1+ import { createColorize } from 'colorize-template' 2 3+ let colorize = createColorize(pico) 4- chalk.red.bold`full {yellow ${"text"}}` 5+ colorize`{red.bold full {yellow ${"text"}}}`

No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: ISC License: LICENSE:0
Reason
Found 11/23 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmarks.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/alexeyraspopov/picocolors/benchmarks.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmarks.yaml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/alexeyraspopov/picocolors/benchmarks.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/testing.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/alexeyraspopov/picocolors/testing.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/testing.yaml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/alexeyraspopov/picocolors/testing.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/testing.yaml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/alexeyraspopov/picocolors/testing.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/testing.yaml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/alexeyraspopov/picocolors/testing.yaml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/benchmarks.yaml:22
- Warn: npmCommand not pinned by hash: .github/workflows/benchmarks.yaml:26
- Warn: npmCommand not pinned by hash: .github/workflows/benchmarks.yaml:28
- Warn: npmCommand not pinned by hash: .github/workflows/testing.yaml:27
- Warn: npmCommand not pinned by hash: .github/workflows/testing.yaml:43
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 5 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/benchmarks.yaml:1
- Warn: no topLevel permission defined: .github/workflows/testing.yaml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 22 are checked with a SAST tool
Score
3.8
/10
Last Scanned on 2025-03-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More