pixelbar
v1.0.0
Published
Generate precise progress bars in terminals with the power of unicode
Downloads
1
Readme
pixelbar
A better way to generate bars, using the power of unicode.
Install
yarn add pixelbar
Usage
import pixelBar from 'pixelbar'
Simple bars with no options
const barText = pixelBar(0, 10) // '[ ]'
const barText = pixelBar(1, 10) // '[█ ]'
const barText = pixelBar(5, 10) // '[█████ ]'
Fancier bars with options
const barText = pixelBar(1, 10, {caps: false}) // '█ '
const barText = pixelBar(1, 10, {width: 20}) // '[██ ]'
Style the color of the bar
You can supply any chalk function(s) to spruce up the coloring. No colorful previews below because markdown doesn't support the styling, but you get the idea:
// red bar
const barText = pixelBar(1, 10, {style: chalk.red})
// red bar on white bg
const barText = pixelBar(1, 10, {style: chalk.red.bgWhite})
Created by
License
MIT © Idan Gazit