Node.js colors包

2018-02-16 09:37 更新

自定義控制臺(tái)colors

語法高亮可幫助你管理代碼的復(fù)雜性。

colors包(npm install colors)為你的控制臺(tái)輸出帶來了類似的好處,使得你更容了解發(fā)生了什么。

它也是最常用的NPM包之一。

它向本地JavaScript字符串添加函數(shù),以便你可以執(zhí)行諸如“some string”.red之類的操作。

例子

// Loading this module modifies String for the entire process 
require("colors"); 

console.log("hello".green); // outputs green text 
console.log("world!".red); // outputs red text 
console.log("Feeling yellow".yellow); // outputs yellow text 
console.log("But you look blue".blue); // outputs yellow text 
console.log("This should cheer you up!".rainbow); // rainbow 


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)