precisebar

2.0.2 • Public • Published

Dependencies star this repo fork this repo Node.js CI

precisebar is a low-level precise text-based progress bar for use in command-line applications.

demo

Where most text-based progress bars use ascii characters, precisebar takes advantage of widespread unicode support to render sub-character lengths.

Why use precisebar?

  • precisebar allows for smaller progress bars
  • precisebar allows for highly precise progress information
  • precisebar only has one dependency, chalk

Installation

yarn install precisebar

Usage

Basic usage:

const bar = require("precisebar");
const progress = 0.3; // Any number 0-1
const charWidth = 15; // Any integer value
console.log(bar.getProgress(progress, charWidth));

Advanced usage:

const bar = require("precisebar");
const progress = 0.3;
const charWidth = 15;
const beginningColor = "cyan";
const endColor = "bgGrey";
console.log(bar.getProgress(progress, charWidth, beginningColor, endColor));

Valid beginning colors:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • blackBright (alias: gray, grey)
  • redBright
  • greenBright
  • yellowBright
  • blueBright
  • magentaBright
  • cyanBright
  • whiteBright
  • Any RGB array (ex: [255, 105, 180])

Valid end colors:

  • bgBlack
  • bgRed
  • bgGreen
  • bgYellow
  • bgBlue
  • bgMagenta
  • bgCyan
  • bgWhite
  • bgBlackBright (alias: bgGray, bgGrey)
  • bgRedBright
  • bgGreenBright
  • bgYellowBright
  • bgBlueBright
  • bgMagentaBright
  • bgCyanBright
  • bgWhiteBright
  • Any RGB array (ex: [248, 248, 255])

License

Blue Oak License v1.0.0 - A modern alternative to the MIT License.

Package Sidebar

Install

npm i precisebar

Weekly Downloads

38

Version

2.0.2

License

BlueOak-1.0.0

Unpacked Size

86.2 kB

Total Files

9

Last publish

Collaborators

  • leebradley