首页 > Web开发 > 详细

NodeJS终端着色colors插件

时间:2014-01-21 01:05:45      阅读:619      评论:0      收藏:0      [点我收藏+]


安装

npm install colors

colors and styles!

bold
italic
underline
inverse
yellow
cyan
white
magenta
green
red
grey
blue
rainbow
zebra
random


Usage

var colors = require(‘./colors‘);

console.log(‘hello‘.green); // outputs green text
console.log(‘i like cake and pies‘.underline.red) // outputs red underlined text
console.log(‘inverse the color‘.inverse); // inverses the color
console.log(‘OMG Rainbows!‘.rainbow); // rainbow (ignores spaces)

Creating Custom themes

var colors = require(‘colors‘);

colors.setTheme({
  silly: ‘rainbow‘,
  input: ‘grey‘,
  verbose: ‘cyan‘,
  prompt: ‘grey‘,
  info: ‘green‘,
  data: ‘grey‘,
  help: ‘cyan‘,
  warn: ‘yellow‘,
  debug: ‘blue‘,
  error: ‘red‘
});

// outputs red text
console.log("this is an error".error);

// outputs yellow text
console.log("this is a warning".warn);


NodeJS终端着色colors插件

原文:http://blog.csdn.net/xiaocie3456/article/details/18350391

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!