我正在尝试使用这个库来设置我的控制台日志的样式:粉笔。
在终端中,我看到的输出没有错误,但没有红色。以前有人用过吗?
import chalk from 'chalk';然后
console.log(chalk.red('This remain white as default'));我在OSX上运行它,React native 0.61.5
发布于 2020-04-27 16:43:14
在使用它之前,您必须要求。
示例:
const chalk = require('chalk'); //Add this并检查chalk.level的设置
const ctx = new chalk.Instance({level: 3});
Level Description
0 All colors disabled
1 Basic color support (16 colors)
2 256 color support
3 Truecolor support (16 million colors)然后你就可以console.log(ctx.red('red text'));了
https://stackoverflow.com/questions/61453873
复制相似问题