Skip to content

Commit ecf2bee

Browse files
authored
chore: use picocolors for colored terminal output (#409)
Replace deprecated nanocolors with picocolors.
1 parent 66b7c80 commit ecf2bee

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import path from 'path'
66
import prettyHrtime from 'pretty-hrtime'
77
import stdin from 'get-stdin'
88
import read from 'read-cache'
9-
import { bold, dim, red, cyan, green } from 'nanocolors'
9+
import pc from 'picocolors'
1010
import { globby } from 'globby'
1111
import slash from 'slash'
1212
import chokidar from 'chokidar'
@@ -118,7 +118,7 @@ buildCliConfig()
118118
.then((results) => {
119119
if (argv.watch) {
120120
const printMessage = () =>
121-
printVerbose(dim('\nWaiting for file changes...'))
121+
printVerbose(pc.dim('\nWaiting for file changes...'))
122122
const watcher = chokidar.watch(input.concat(dependencies(results)), {
123123
usePolling: argv.poll,
124124
interval: argv.poll && typeof argv.poll === 'number' ? argv.poll : 100,
@@ -213,7 +213,7 @@ function css(css, file) {
213213

214214
const time = process.hrtime()
215215

216-
printVerbose(cyan(`Processing ${bold(relativePath)}...`))
216+
printVerbose(pc.cyan(`Processing ${pc.bold(relativePath)}...`))
217217

218218
return rc(ctx, argv.config)
219219
.then((config) => {
@@ -261,7 +261,9 @@ function css(css, file) {
261261
return Promise.all(tasks).then(() => {
262262
const prettyTime = prettyHrtime(process.hrtime(time))
263263
printVerbose(
264-
green(`Finished ${bold(relativePath)} in ${bold(prettyTime)}`)
264+
pc.green(
265+
`Finished ${pc.bold(relativePath)} in ${pc.bold(prettyTime)}`
266+
)
265267
)
266268

267269
const messages = result.warnings()
@@ -316,7 +318,7 @@ function error(err) {
316318
if (argv.verbose) console.error()
317319

318320
if (typeof err === 'string') {
319-
console.error(red(err))
321+
console.error(pc.red(err))
320322
} else if (err.name === 'CssSyntaxError') {
321323
console.error(err.toString())
322324
} else {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"fs-extra": "^10.0.0",
2424
"get-stdin": "^9.0.0",
2525
"globby": "^12.0.0",
26-
"nanocolors": "^0.2.11",
26+
"picocolors": "^1.0.0",
2727
"postcss-load-config": "^3.0.0",
2828
"postcss-reporter": "^7.0.0",
2929
"pretty-hrtime": "^1.0.3",

0 commit comments

Comments
 (0)