npm install ternal
const { echo } = require('ternal');
echo('blue', 'Hello World');
const Ternal = require('ternal');
let ternal = new Ternal('blue');
ternal.print('Hello World');
New instance with blue background:
let ternal = new Ternal({
bg:'blue'
});
ternal.print('Hello World');
Same instance, change color:
ternal.set({color:'red'}).print('Hello World');
Remove background and underline text:
ternal.set({bg: null, format: 'underline'}).print('Hello World');
Reset to defaults:
ternal.reset().print('Hello World');
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');
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"
foo:bar foo$ xternal --reset
foo:bar foo$ echo "Hello World"