Ælex
Ælex

Reputation: 14839

command line drawing unicode boxes for a graph

I don't know what the correct keywords are for what I am trying to achieve.

I have rainbarf for tmux which AFAIK is written in Perl. I am wondering if there is some library, extension or functionality in node.js which would enable me to draw bars like the ones rainbarf draws, in order to write tmux monitors (wifi, GPU usage, etc).

Edit

I think that the correct term is unicode boxes as I have finally found a page that documents them.

They seem to be unicode geometric shapes So I am guessing that correctly printing them to screen (assuming the terminal supports them) should achieve the same result?

They appear to be small pixel-sized boxes constrained by the size of a font.

example 1 example 2

Upvotes: 1

Views: 424

Answers (2)

creaktive
creaktive

Reputation: 5220

rainbarf is inspired on spark. There are several implementations of spark in JavaScript (and also other languages), check here: https://github.com/holman/spark/wiki/Alternative-Implementations

Upvotes: 2

Ælex
Ælex

Reputation: 14839

I found the answer to my question. This is not related to Node.JS and is in fact simple unicode character printing.

The above picture simply prints a sequence of those characters in a sequence:

'\u2581','\u2582','\u2583','\u2584',
'\u2585','\u2586','\u2587','\u2588'

This in effect produces the "unicode" graph. It is not language specific, but the colors are.

Upvotes: 0

Related Questions