utf8-bar
v0.1.0
Published
```shell npm install utf8-bar ```
Downloads
15,585
Readme
utf8-bar
npm install utf8-bar
Usage
const utf8Bar = require('utf8-bar');
utf8Bar(20, 0.33); // ██████▋
utf8Bar(20, 0.66); // █████████████▎
utf8Bar(20, 1.00); // ████████████████████
Reference
utf8Bar(characters, percentage)
characters
(number) - How many characters long string to return.percentage
(double) - What portion of the string to color.
Example
const utf8Bar = require('utf8-bar');
const chars = 10;
const max = 100;
for (let i = 0; i <= max; i++) {
console.log(utf8Bar(chars, i / max));
}
outputs
▏
▎
▎
▍
▌
▋
▊
▊
▉
█
█▏
█▎
█▎
█▍
█▌
█▋
█▊
█▊
█▉
██
██▏
██▎
██▎
██▍
██▌
██▋
██▊
██▊
██▉
███
███▏
███▎
███▎
███▍
███▌
███▋
███▊
███▊
███▉
████
████▏
████▎
████▎
████▍
████▌
████▋
████▊
████▊
████▉
█████
█████▏
█████▎
█████▎
█████▍
█████▌
█████▋
█████▊
█████▊
█████▉
██████
██████▏
██████▎
██████▎
██████▍
██████▌
██████▋
██████▊
██████▊
██████▉
███████
███████▏
███████▎
███████▎
███████▍
███████▌
███████▋
███████▊
███████▊
███████▉
████████
████████▏
████████▎
████████▎
████████▍
████████▌
████████▋
████████▊
████████▊
████████▉
█████████
█████████▏
█████████▎
█████████▎
█████████▍
█████████▌
█████████▋
█████████▊
█████████▊
█████████▉
██████████