Colorette continues to work as-is. No need to do anything.
To override color-detection, there's a new createColors(options) that returns an object with all the available color functions. Terminal support is auto-detected, override it via options.useColor.
options.enabled has been removed in favor of createColors(options).
There's a new isColorSupported constant export.
true if the terminal supports color, false otherwise.
If you were previously using options.enabled and wish to override automatic color detection, use createColors().
import { createColors } from "colorette"
...
const { blue } = createColors({ useColor: myOptions.enabled })
console.log(blue("I'm blue"))
If you're upgrading from
1.x
:createColors(options)
that returns an object with all the available color functions. Terminal support is auto-detected, override it viaoptions.useColor
.options.enabled
has been removed in favor ofcreateColors(options)
.isColorSupported
constant export.true
if the terminal supports color,false
otherwise.If you were previously using
options.enabled
and wish to override automatic color detection, usecreateColors()
.