Gathering detailed insights and metrics for @brillout/picocolors
Gathering detailed insights and metrics for @brillout/picocolors
Gathering detailed insights and metrics for @brillout/picocolors
Gathering detailed insights and metrics for @brillout/picocolors
npm install @brillout/picocolors
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,371 Stars
89 Commits
45 Forks
10 Watching
1 Branches
13 Contributors
Updated on 28 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
9.7%
7,829
Compared to previous day
Last week
8.5%
37,997
Compared to previous week
Last month
0.9%
148,734
Compared to previous month
Last year
300.2%
1,429,266
Compared to previous year
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_COLOR
friendly.With picocolors
we are trying to draw attention to the node_modules
size
problem and promote performance-first culture.
Credits go to the following projects:
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
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
and bright variants bgBlackBright
, bgRedBright
, bgGreenBright
, bgYellowBright
, bgBlueBright
, bgMagentaBright
, bgCyanBright
, bgWhiteBright
.
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
and bright variants blackBright
, redBright
, greenBright
, yellowBright
, blueBright
, magentaBright
, cyanBright
, whiteBright
.
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 screen
1import 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 configuration
1import pc from "picocolors" 2 3let { red, bgWhite } = pc.createColors(options.enableColors)
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
8 commit(s) and 6 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 11/23 approved changesets -- score normalized to 4
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
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