console-control-strings
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Console-control-strings is an NPM package that provides tested terminal/console command strings to execute functions like color alteration and cursor positioning. A feature of interest is its compatibility with both Windows and Unix-like operating systems, leaving aside any exceptions. It's essentially a subset of both ANSI and VT100. The library strives to emit standalone start color codes, emits strings without writing to streams, and avoids carrying unnecessary baggage. The main advantages of using console-control-strings are its clear compatibility goals and its ability to return strings without writing to streams.
In order to use console-control-strings, it first needs to be required in your JavaScript file. After that, you can call its functions to perform various operations on the console. For instance, to change the color of text, you might use consoleControl.color(...)
, passing in the desired colors and styles. Cursor movements are possible through the consoleControl.goto(...)
function, allowing specific cursor positioning. Here is a basic example:
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))
In this code, 'hi there' will be printed in bold with blue text on a red background. The cursor is then moved to the location (75,10).
The documentation for console-control-strings can be found in the README file on the pacakage's GitHub repository, available at the URL: https://github.com/iarna/console-control-strings. It details the different functions and parameter options available, along with descriptions of their effects.