插件中的chalk的用法
来源:互联网 发布:数据库平台 编辑:程序博客网 时间:2024/04/28 14:00
chalk是什么
chalk是一个颜色的插件。可以通过chalk.blue(‘hello world’)来改变颜色,但是我并没有式样成功,有待验证。
可以参考 npm chalk官网
- 简单用法
$ npm install chalk
const chalk = require('chalk'); console.log(chalk.blue('Hello world!'));
const chalk = require('chalk');const log = console.log;// Combine styled and normal strings log(chalk.blue('Hello') + 'World' + chalk.red('!'));// Compose multiple styles using the chainable API log(chalk.blue.bgRed.bold('Hello world!'));// Pass in multiple arguments log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));// Nest styles log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));// Nest styles of the same type even (color, underline, background) log(chalk.green( 'I am a green line ' + chalk.blue.underline.bold('with a blue substring') + ' that becomes green again!'));// ES2015 template literal log(`CPU: ${chalk.red('90%')}RAM: ${chalk.green('40%')}DISK: ${chalk.yellow('70%')}`);// ES2015 tagged template literal log(chalk`CPU: {red ${cpu.totalPercent}%}RAM: {green ${ram.used / ram.total * 100}%}DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}`);// Use RGB colors in terminal emulators that support it. log(chalk.keyword('orange')('Yay for orange colored text!'));log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));log(chalk.hex('#DEADED').bold('Bold gray!'));
阅读全文
0 0
- 插件中的chalk的用法
- chalk
- Moq插件的用法
- inputclean插件的用法
- BlackBerry Chalk Pushcast Software
- eclipse插件svn的用法
- TopCoder中插件的用法
- Google插件switchysharp的用法
- iscroll插件的一些用法
- 插件的用法和实现
- 关于 chartjs插件的用法
- datetimepicker.js插件的用法
- easyui datagridfilter插件的用法
- mobiscroll时间插件的用法
- jad的两个简单用法及jadeclipse插件在myeclipse6.x中的安装
- oracle中的(+)的用法
- java中的<<<、<<、>>>、>>的用法
- js中的$()的用法
- 每周荐书:Kotlin、分布式、Keras(评论送书)
- 欢迎使用CSDN-markdown编辑器
- linux命令英文缩写的含义(方便记忆)
- 二叉树的线索化
- 使用Date时,出现"Incorrect datetime value: '' for column 'ordertime' at row 1 Query..."时,该怎么解决呢?
- 插件中的chalk的用法
- 浅谈java中nio的使用方式
- 8种php基本排序实现方法
- Oauth 2.0
- 算法---求两个数的最大公约数(递归)
- 拷贝构造和拷贝赋值
- Angular2与AngularJS的区别
- ClassNotFoundException: org.springframework.web.context.ContextLoaderListener正解之一
- jqGrid多次表头排序会累加排序条件问题