picocolors
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Picocolors is a minimalistic yet powerful library that formats terminal output with ANSI colors. It stands out for its speed and size - it's 14 times smaller and twice as fast as its competitor, Chalk. Besides, Picocolors has no dependencies, meaning it adds virtually no weight to your project. Being used by popular tools including PostCSS, SVGO, Stylelint, and Browserslist, it offers support for Node.js v6+ and browsers, and it's functionality meets the standards of both CJS and ESM projects. Furthermore, it is friendly with NO_COLOR
, providing adequate compatibility for colorless environments.
To use Picocolors in your project, first, you need to import it. One simple way to do this is with JavaScript's import
syntax as shown below:
import pc from "picocolors"
console.log(
pc.green(`How are ${pc.italic(`you`)} doing?`)
)
In this example, the text is colorized using the green
function and styled with the italic
function. The processed text will be displayed in the terminal output. Note that Picocolors supports a range of functions for different text styles and colors.
The full documentation for Picocolors can be found on its GitHub readme page. You'll find a detailed description of the available features, numerous code examples, and other essential information that can assist you in utilizing this library to its full extent. Whether you're trying this library for the first time or troubleshooting an issue, the Picocolors docs offer an excellent resource pool.