Socket
Book a DemoInstallSign in
Socket

clivas

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clivas

use your terminal as a canvas. features easy redrawing, colors and more

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
297
6.45%
Maintainers
1
Weekly downloads
 
Created
Source

clivas

Turn your terminal into a canvas.

It is available through npm:

npm install clivas

Usage

It is easy to use

var clivas = require('clivas');

var frame = 0;

setInterval(function() {
	clivas.clear(); // clears the canvas
	clivas.line('hello world (#frame '+frame+')');
	clivas.line('{red:also} {green:colors}!');
	frame++;
}, 200);

When you draw something with clivas you can use the format patten to help you

clivas.line('{red:i am red} and {blue: i am blue}');

If you wanted to inverse a color you would provide the inverse tag

clivas.line('{red+inverse:i am inversed}');

The format pattern can also help you add whitespace

clivas.line('[{10:===>}]'); // prints [===>      ]

API

  • clivas.clear() - Clears the screen. If you called clivas.pin() it would only clear up until the pin.

  • clivas.flush() - Clears everything below the cursor.

  • clivas.pin([lineNumber]) - Only clear to here when clivas.clear() is called

  • clivas.line(str) - Write a line (accepts a format string as described above)

  • clivas.write(str) - Same as clivas.line(str) except it does not add a newline

  • clivas.cursor(enable) - Enable or disable the terminal cursor

  • clivas.alias(name, value) - Add an alias to the format pattern i.e. clivas.alias('link', 'red+underline') enables you to use {link:http://google.com}

License

MIT

Keywords

canvas

FAQs

Package last updated on 27 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts