【文件属性】:
文件名称:colorette:使用纯熟JavaScript为终端着色
文件大小:8KB
文件格式:ZIP
更新时间:2021-01-30 19:01:57
cli node colors ansi CommandlineinterfaceJavaScript
色板
使用纯惯用JavaScript为终端着色。
Colorette是一个Node.js库,用于使用为您的CLI工具添加颜色和样式。
比替代品快1.5倍()。
没有基于原型的怪异方法链。
自动颜色支持检测。
〜80 LOC,无依赖性。
友好。
快速开始
npm i colorette
导入您需要的。 是您可以使用的样式列表。
import { red , blue , bold } from "colorette"
用一种或多种样式包裹您的琴弦,以产生出所需的效果。
console . log ( bold ( blue ( "Engage!" ) ) )
将其与混合使用以插值变量,表达式并轻松创建多行字符串。
console . log ( `
Beets are ${ red ( "red" ) } ,
Plums are ${ blue ( "blue" ) } ,
${ bold ( "Colorette!" ) } .
` )
使用console.log的也可能很有用。
console . log ( bold ( "Total: $
【文件预览】:
colorette-master
----.github()
--------workflows()
----bench()
--------index.js(763B)
--------package.json(172B)
----test()
--------index.cjs(3KB)
--------FORCE_COLOR.sh(128B)
--------NO_COLOR.sh(96B)
----LICENSE.md(1KB)
----colorette.d.ts(1KB)
----README.md(4KB)
----.gitignore(166B)
----index.js(2KB)
----package.json(1KB)