Module ringo/term

A module for printing ANSI terminal escape sequences. This module provides a number of useful color and style constants, and a replacement for the print function optimized for styled output.

Example

include('ringo/term')
writeln(YELLOW, "foo", MAGENTA, "bar");
// foo bar
writeln(YELLOW, ONBLUE, "IKEA");
// IKEA
writeln(RED, BOLD, INVERSE, "Red Alert!");
// Red Alert!

See


RED


TermWriter (out)

Creates a terminal writer that writes to the given text output stream.

Parameters

Stream out a TextStream

TermWriter.prototype.isEnabled ()

Returns true if ANSI terminal colors are enabled.

Returns

true if ANSI is enabled.

TermWriter.prototype.setEnabled (flag)

Enable or disable ANSI terminal colors for this writer.

Parameters

boolean flag true to enable ANSI colors.

TermWriter.prototype.write (args...)

Write the arguments to the stream, applying ANSI terminal colors if enabled is true.

Parameters

args... variable number of arguments to write

TermWriter.prototype.writeln (args...)

Write the arguments to the stream followed by a newline character, applying ANSI terminal colors if enabled is true.

Parameters

args... variable number of arguments to write

write (args...)

Write the arguments to system.stdout, applying ANSI terminal colors if support has been detected.

Parameters

args... variable number of arguments to write

writeln (args...)

Write the arguments to system.stdout followed by a newline character, applying ANSI terminal colors if support has been detected.

Parameters

args... variable number of arguments to write