colorize
一个基于picocolors封装的colorful terminal输出库
Install
npm i @simonhe/colorize
Usage
import colorize from '@simonhe/colorize'
colorize({
text:'hi',
color:'red',
})
colorize({
text:'hi',
bgColor:'red',
})
colorize({
text:'hi',
bgColor:'red',
dimmed:true
})
/*
color?: IColors
bgColor?: IColors
dimmed?: boolean
bold?: boolean
italic?: boolean
underline?: boolean
strikethrough?: boolean
inverse?: boolean
text: string
*/
Why use picocolors
- No dependencies.
- 14 times smaller and 2 times faster than chalk.
- Used by popular tools like PostCSS, SVGO, Stylelint, and Browserslist.
- Node.js v6+ & browsers support. Support for both CJS and ESM projects.
- TypeScript type declarations included.
- NO_COLOR friendly.
License
MIT