Gathering detailed insights and metrics for @poppinss/colors
Gathering detailed insights and metrics for @poppinss/colors
Gathering detailed insights and metrics for @poppinss/colors
Gathering detailed insights and metrics for @poppinss/colors
npm install @poppinss/colors
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.5
Supply Chain
98.6
Quality
80.8
Maintenance
100
Vulnerability
100
License
Update dependencies
Updated on Dec 24, 2024
Update dependencies
Updated on Mar 28, 2024
Updating dependencies
Updated on Dec 15, 2023
Publish source map and use TSC for generating types
Updated on Nov 06, 2023
Publish under latest release
Updated on Oct 14, 2023
Use tsup for bundling
Updated on Sep 23, 2023
TypeScript (99.52%)
JavaScript (0.48%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
5 Stars
97 Commits
2 Forks
3 Watchers
1 Branches
4 Contributors
Updated on Dec 24, 2024
Minified
Minified + Gzipped
Latest Version
4.1.4
Package Id
@poppinss/colors@4.1.4
Unpacked Size
14.67 kB
Size
4.54 kB
File Count
11
NPM Version
10.8.2
Node Version
20.18.1
Published on
Dec 24, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Wrapper over kleur with better support for testing
This package is a wrapper over kleur with additional implementations to make testing easier and work seamlessly with terminals/stdout streams that do not support colors.
Install the package from the npm registry as follows.
1npm i @poppinss/colors
And use it as follows. The ansi
method returns an instance of the kleur package.
1import useColors from '@poppinss/colors' 2const colors = useColors.ansi() 3 4console.log(colors.red('this is an error')) 5console.log(colors.cyan('hello world'))
Chaining methods
1const colors = useColors.ansi() 2console.log(colors.red().bgBlack('this is an error'))
The raw implementation is ideal for testing. Instead of outputting ANSI escape codes, we wrap the string with transformation names. For example:
1import useColors from '@poppinss/colors' 2const colors = useColors.raw() 3 4console.log(colors.red('hello world')) 5// OUTPUT: red(hello world) 6 7console.log(colors.bgBlack().red('hello world')) 8// OUTPUT: bgBlack(red(hello world))
As you can notice, the output is a plain text value, so it is easier to write assertions against it.
1assert.equal(colors.red('hello world'), 'red(hello world)')
The silent mode does not perform any transformations on the string and returns the value. This is helpful when the output terminal or stdout stream does not support colors.
1import useColors from '@poppinss/colors' 2const colors = useColors.silent() 3 4console.log(colors.red('hello world')) 5// OUTPUT: hello world 6 7console.log(colors.bgBlack().red('hello world')) 8// OUTPUT: hello world
Ideally, you will use one of the available implementations based on some runtime environment. For example:
1import useColors from '@poppinss/colors' 2import supportsColor from 'supports-color' 3 4const isTestEnv = process.env.NODE_ENV === 'test' 5 6const colors = isTestEnv 7 ? useColors.raw() // use raw in test environment 8 : supportsColor.stdout 9 ? useColors.ansi() // use kleur when stdout has colors 10 : useColors.silent() // use silent mode 11 12export default colors
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-23
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