colorette
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Colorette is a versatile JavaScript library, ideal for setting the color and style of your terminal text in an effortless and efficient way. It offers the advantage of no dependencies and an automatic color support detection feature. Colorette also ensures excellent performance with speed up to 2 times faster than its alternatives. It also provides TypeScript support and observes standards such as the NO_COLOR
guideline. Compatibility-wise, it works with Node 10 and above versions.
Using Colorette in your JavaScript projects is quite straightforward. First, you need to install it via npm with the command npm install colorette
.
Once installed, you can import Colorette into your project and use it to add color to your terminal text as shown below:
import { blue, bold, underline } from "colorette"
console.log(
blue("I'm blue"),
bold(blue("da ba dee")),
underline(bold(blue("da ba daa")))
)
Colorette offers support for nesting of styles:
console.log(bold(`I'm ${blue(`da ba ${underline("dee")} da ba`)} daa`))
And overriding terminal color detection:
import { createColors } from "colorette"
const { blue } = createColors({ useColor: false })
console.log(blue("Blue? Nope, nah"))
The Colorette documentation can be found within the README file on its GitHub repository page located at https://github.com/jorgebucaran/colorette. It provides essential information about the API methods, environment configuration, usage examples, and the list of supported colors. It also hosts information about performance benchmarks and acknowledgment notes.