Muqriz 48f16bfc3e initail first | 4 months ago | |
---|---|---|
.. | ||
LICENSE | 4 months ago | |
README.md | 4 months ago | |
README.md~ | 4 months ago | |
index.js | 4 months ago | |
package.json | 4 months ago |
A library of cross-platform tested terminal/console command strings for doing things like color and cursor positioning. This is a subset of both ansi and vt100. All control codes included work on both Windows & Unix-like OSes, except where noted.
var consoleControl = require('console-control-strings')
console.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset'))
process.stdout.write(consoleControl.goto(75, 10))
There are tons of libraries similar to this one. I wanted one that was:
Returns the escape sequence to move num lines up.
Returns the escape sequence to move num lines down.
Returns the escape sequence to move num lines righ.
Returns the escape sequence to move num lines left.
Returns the escape sequence to move num lines down and to the beginning of the line.
Returns the escape sequence to move num lines up and to the beginning of the line.
Returns the escape sequence to erase everything from the current cursor position to the bottom right of the screen. This is line based, so it erases the remainder of the current line and all following lines.
Returns the escape sequence to erase to the end of the current line.
Returns the escape sequence to move the cursor to the designated position. Note that the origin is 1, 1 not 0, 0.
Returns the escape sequence to move the cursor to the beginning of the
current line. (That is, it returns a carriage return, \r
.)
Returns the escape sequence to cause the termianl to beep. (That is, it
returns unicode character \x0007
, a Control-G.)
Returns the escape sequence to hide the cursor.
Returns the escape sequence to show the cursor.
Returns the escape sequence to set the current terminal display attributes
(mostly colors). Arguments can either be a list of attributes or an array
of attributes. The difference between passing in an array or list of colors
and calling .color
separately for each one, is that in the former case a
single escape sequence will be produced where as in the latter each change
will have its own distinct escape sequence. Each attribute can be one of: