Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/terminal > Colorize

Colorize class

The static functions on this class are used to produce colored text for use with a terminal that supports ANSI escape codes.

Note that this API always generates color codes, regardless of whether the process's stdout is a TTY. The reason is that, in a complex program, the code that is generating strings often does not know were those strings will end up. In some cases, the same log message may get printed both to a shell that supports color AND to a log file that does not.

Signature:

export declare class Colorize 

Example

console.log(Colorize.red('Red Text!'))
terminal.writeLine(Colorize.green('Green Text!'), ' ', Colorize.blue('Blue Text!'));

Methods

Method

Modifiers

Description

black(text)

static

blackBackground(text)

static

blink(text)

static

blue(text)

static

blueBackground(text)

static

bold(text)

static

cyan(text)

static

cyanBackground(text)

static

dim(text)

static

gray(text)

static

grayBackground(text)

static

green(text)

static

greenBackground(text)

static

hidden(text)

static

invertColor(text)

static

magenta(text)

static

magentaBackground(text)

static

rainbow(text)

static

red(text)

static

redBackground(text)

static

underline(text)

static

white(text)

static

whiteBackground(text)

static

yellow(text)

static

yellowBackground(text)

static