1.0.3 • Published 4 years ago

ternal v1.0.3

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

Ternal

A node library for easily formatting console output.

![Version](https://img.shields.io/endpoint?url=https%3A%2F%2Fsrcer.com%2Fshields%2FTernal%2FVersion%2Finformational) ![Status](https://img.shields.io/endpoint?url=https%3A%2F%2Fsrcer.com%2Fshields%2FTernal%2FStatus%2Fsuccess) ![Size](https://img.shields.io/endpoint?url=https%3A%2F%2Fsrcer.com%2Fshields%2FTernal%2FSize%2Finformational) ![License](https://img.shields.io/endpoint?url=https%3A%2F%2Fsrcer.com%2Fshields%2FTernal%2FLicense%2Fgreen)

Install

npm install ternal

Usage

The quick way:

const { echo } = require('ternal');
echo('blue', 'Hello World');
Output:

Hello World blue

Using a ternal instance:

const Ternal = require('ternal');

let ternal = new Ternal('blue');
ternal.print('Hello World');
Output:

Hello World blue

New instance with blue background:

let ternal = new Ternal({
    bg:'blue'
});
ternal.print('Hello World');
Output:

Hello World blue background

Same instance, change color:

    ternal.set({color:'red'}).print('Hello World');
Output:

Hello World red blue background

Remove background and underline text:

ternal.set({bg: null, format: 'underline'}).print('Hello World');
Output:

Hello World red underlined

Reset to defaults:

ternal.reset().print('Hello World');
Output:

Hello World plain text

Call ternal.set() with the second parameter set to true to change your terminal defaults:

ternal.set({
    color:'blue',
    bg:'white',
    format:'bold'
}, true);

console.log('I am blue and bold');
console.log('So am I')
ternal.reset('Let\'s go back to normal');
console.log('Now I\'m normal again');
Output:

Hello World multiline

Command Line

You can also use ternal straight from the command line:

foo:bar foo$ ternal set blue
#blue output
foo:bar foo$ ternal reset

Or use the command ternal globalize to place the xternal executable in your global path:

foo:bar foo$ ternal globalize

xternal command now globally executable.

foo:bar foo$ xternal blue

foo:bar foo$ echo "Hello World"
Output:

Hello World blue

foo:bar foo$ xternal --reset

foo:bar foo$ echo "Hello World"
Output:

Hello World blue

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

1.0.0

4 years ago

0.1.1

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago