码迷,mamicode.com
首页 > 其他好文 > 详细

npm的chalk包的使用

时间:2020-01-19 00:06:07      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:span   key   src   pre   png   keyword   ade   ant   console   

  使用chalk定义输出样式:Chalk comes with an easy to use composable API where you just chain and nest the styles you want.

技术图片

 

 

const chalk = require(‘chalk‘)

console.log(chalk.blue(‘Hello world!‘))


console.log(chalk.hex(‘#DEADED‘).underline(‘Hello, world!‘))
console.log(chalk.keyword(‘orange‘)(‘Some orange text‘))
console.log(chalk.rgb(15, 100, 204).inverse(‘Hello!‘))

console.log(`==========================`)
const error = chalk.bold.red;
const warning = chalk.keyword(‘orange‘);

console.log(error(‘Error!‘));
console.log(warning(‘Warning!‘));

---

技术图片

npm的chalk包的使用

标签:span   key   src   pre   png   keyword   ade   ant   console   

原文地址:https://www.cnblogs.com/xy-ouyang/p/12210608.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!