Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
control-terminal
Advanced tools
Control terminal cursor, screen and create string styling
Install using pnpm:
pnpm add control-terminal
Or yarn:
yarn add control-terminal
Or npm:
npm i control-terminal
import * as terminal from 'control-terminal';
console.log(terminal.style.bold.blue('Hello world!'));
console.log(terminal.style.bgBlue.hex('#ff7b72')('Blue backgroud'));
terminal.cursor.erasePreviousLine();
console.log(terminal.style.bgRgb(255, 123, 114).underline('Underline'));
Output:
The methods in terminal.cursor
namespace will help you control cursor and terminal.
Moving cursor methods:
goTo(line: number, column: number)
: Move the cursor to a specific position (line >= 1, column >= 1)gotoStart()
: Move the cursor to line 1, column 1carriageReturn()
: Move the cursor to start of lineup(line: number = 1)
: Move the cursor up line
linesdown(line: number = 1)
: Move the cursor down line
linesforward(column: number = 1)
: Move the cursor forward column
columnsbackward(column: number = 1)
: Move the cursor backward column
columnspreviousLine()
: Move the cursor up 1 line, column 1Clear screen methods:
clearScreen()
: Clear the screenreset()
: Reset deviceeraseCurrentLine()
: Erase the current line of the cursoreraseToEndLine()
: Erase to the end of line that begins the cursor's current positioneraseToEndScreen()
: Erase to the end of screen that begins the cursor's current positionerasePreviousLine(line: number = 1)
: Erase the previous line from the cursorOther methods:
hide()
: Hide cursorsave()
: Save cursor positionrestore()
: Restore cursor positionThe terminal.style
namespace will help you string styling.
Modifiers:
reset
: Resets the current color chain.bold
: Make text bold.dim
: Emitting only a small amount of light.italic
: Make text italic. (Not widely supported)underline
: Make text underline. (Not widely supported)slowBlink
: Make text slow blink. (Not widely supported)rapidBlink
: Make text rapid blink. (Not widely supported)inverse
: Inverse background and foreground colors.hidden
: Prints the text, but makes it invisible.strikethrough
: Puts a horizontal line through the center of the text. (Not widely supported)fraktur
: Make text fraktur. (Not widely supported)framed
: Make text framed. (Not widely supported)encircled
: Make text encircled. (Not widely supported)overline
: Make text overline. (Not widely supported)Colors:
black
red
green
yellow
blue
magenta
cyan
white
blackBright
redBright
greenBright
yellowBright
blueBright
magentaBright
cyanBright
whiteBright
Background colors:
bgBlack
bgRed
bgGreen
bgYellow
bgBlue
bgMagenta
bgCyan
bgWhite
bgBlackBright
bgRedBright
bgGreenBright
bgYellowBright
bgBlueBright
bgMagentaBright
bgCyanBright
bgWhiteBright
Example:
console.log(terminal.style.bold.bgCyan.green('Hello'));
console.log(terminal.style.italic.bgBlack.white.underline('Hello'));
console.log(terminal.style.white.inverse.bgMagentaBright('Hello'));
Control Terminal support True color (16 million colors) on terminal applications.
The following color models can be used:
RGB:
rgb(red: number, green: number, blue: number)
terminal.style.rgb(88, 166, 255)('Blue text');
bgRgb(red: number, green: number, blue: number)
terminal.style.bgRgb(88, 166, 255)('Blue background');
Hex:
hex(hex: string)
terminal.style.hex('#58a6ff')('Blue text');
bgHex(hex: string)
terminal.style.bgHex('#58a6ff')('Blue background');
FAQs
Control terminal cursor, screen and create string styling
The npm package control-terminal receives a total of 0 weekly downloads. As such, control-terminal popularity was classified as not popular.
We found that control-terminal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.