alexeyraspopov / picocolors

The tiniest and the fastest library for terminal output formatting with ANSI colors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add API to manually change color mode

ai opened this issue · comments

PostCSS, Logux Server and some other Nano Colors users have own options to change colors.

Can we have a way to manually change support mode like:

import { createColor } from 'picocolors'

let { red } = createColor(options.color)

Or:

import { setColors, isColorSupported } from 'picocolors'

setColors(options.color ?? isColorSupported)

In #22 I've implemented a similar to nanocolors and colorette approach, though some input needed since I'm not entirely convinced about the proper use case for this feature. Once review is done, we can definitely ship another version.