Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/madbence/node-drawille
Drawing in terminal with unicode braille characters
https://github.com/madbence/node-drawille
Last synced: about 8 hours ago
JSON representation
Drawing in terminal with unicode braille characters
- Host: GitHub
- URL: https://github.com/madbence/node-drawille
- Owner: madbence
- License: mit
- Created: 2014-05-05T16:43:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-10-16T21:40:07.000Z (about 2 years ago)
- Last Synced: 2024-12-05T23:02:47.695Z (7 days ago)
- Language: JavaScript
- Size: 558 KB
- Stars: 1,008
- Watchers: 19
- Forks: 28
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nodejs-cn - drawille - 使用 Unicode 盲文字符在终端上绘图 (包 / 命令行工具)
- awesome-nodejs-cn - drawille - **star:1010** 用unicode字符在终端上绘制 (包 / 命令行实用工具)
- awesome-blessed - drawille
- awesome-nodejs - drawille - Draw on the terminal with unicode braille characters. (Packages / Command-line utilities)
- awesome-nodejs - node-drawille - Drawing in terminal with unicode braille characters - ★ 763 (Command-line utilities)
- awesome-node - drawille - Draw on the terminal with unicode braille characters. (Packages / Command-line utilities)
- awesome-nodejs-cn - drawille - 使用Unicode盲文字符在终端上绘图. (目录 / 命令行工具)
README
# node-drawille [![Build Status](https://travis-ci.org/madbence/node-drawille.svg)](https://travis-ci.org/madbence/node-drawille)
> drawing in terminal with [unicode braille][] characters. The idea is based on [drawille](https://github.com/asciimoo/drawille) by @asciimoo.
![cube](cube.gif)
## install
install the [package](https://npmjs.com/drawille) with `npm`:
```
$ npm install --save drawille
```## usage
See [examples](examples).
this module provides a very basic API only, for fancy things, like drawing lines, use another module, like [`bresenham`](https://github.com/madbence/node-bresenham).
[`drawille-canvas`](https://github.com/madbence/node-drawille-canvas) provides HTML5 Canvas API for drawille.
## api
### `Canvas(w, h)`
Create a new canvas with the given dimensions.
`w` must be multiple of 2, `h` must be multiple of 4.
Uses `columns` & `rows` from `process.stdout` as default values for `w` and `h`.### `canvas.set(x, y)`
Draw point on `canvas` at the given position.
### `canvas.unset(x, y)`
Delete point on `canvas` at the given position.
### `canvas.toggle(x, y)`
Toggle point on `canvas` at the given position.
### `canvas.clear()`
Clear the whole canvas (delete every point).
### `canvas.frame(delimiter)`
return the current content of `canvas`, as a `delimiter`-delimited
string. `delimiter` defaults to `\n`.it uses braille characters to represent points,
so every line has length of `w/2`, and the string contains `h/4`
lines.## projects
- [`vtop`](https://github.com/MrRio/vtop) uses it to draw CPU and memory usage charts in the terminal
- [`datop`](https://github.com/maxogden/datop) uses it to draw [dat](https://github.com/maxogden/dat) statistics
- [`boscillate`](https://www.npmjs.org/package/boscillate) uses it to draw [`baudio`](https://github.com/substack/baudio) soundwaves in real-time## license
MIT
[unicode braille]: http://en.wikipedia.org/wiki/Braille_Patterns#Chart