Documentation

Cli
in package

Tool coloring cli text and background, using green (success), red (error), orange (warning) and black

Table of Contents

BLACK  = '0;30'
Black text color
ERROR  = 41
Red background color
GREEN  = '0;32'
Green text color
ORANGE  = '0;33'
Orange text color
RED  = '0;31'
Red text color
SUCCESS  = 42
Green background color
WARNING  = 43
Orange background color
colorBackgroundString()  : string
Set a background color on a text using black text color
colorString()  : string
Set a color on a text
error()  : void
Display text in red and stop the program
errorBg()  : void
Display text in black with red background and stop the program
success()  : void
Display text in green with carriage return or not
successBg()  : void
Display text in black and green background with carriage return or not
warning()  : void
Display text in orange with carriage return or not
warningBg()  : void
Display text in black and orange background with carriage return or not

Constants

BLACK

Black text color

public string BLACK = '0;30'

ERROR

Red background color

public int ERROR = 41

GREEN

Green text color

public string GREEN = '0;32'

ORANGE

Orange text color

public string ORANGE = '0;33'

RED

Red text color

public string RED = '0;31'

SUCCESS

Green background color

public int SUCCESS = 42

WARNING

Orange background color

public int WARNING = 43

Methods

colorBackgroundString()

Set a background color on a text using black text color

public static colorBackgroundString(string $string, int $color) : string
Parameters
$string : string

Text to display

$color : int

Background color

Return values
string

Text with color bakcground

colorString()

Set a color on a text

public static colorString(string $string[, null|string $color = self::GREEN ]) : string
Parameters
$string : string

Text to display

$color : null|string = self::GREEN
Return values
string

Text with color

error()

Display text in red and stop the program

public static error(string $string) : void
Parameters
$string : string

Text to display

Return values
void

errorBg()

Display text in black with red background and stop the program

public static errorBg(string $string) : void
Parameters
$string : string

Text to display

Return values
void

success()

Display text in green with carriage return or not

public static success(string $string[, null|bool $return = false ]) : void
Parameters
$string : string

Text to display

$return : null|bool = false
Return values
void

successBg()

Display text in black and green background with carriage return or not

public static successBg(string $string[, null|bool $return = false ]) : void
Parameters
$string : string

Text to display

$return : null|bool = false
Return values
void

warning()

Display text in orange with carriage return or not

public static warning(string $string[, null|bool $return = false ]) : void
Parameters
$string : string

Text to display

$return : null|bool = false
Return values
void

warningBg()

Display text in black and orange background with carriage return or not

public static warningBg(string $string[, null|bool $return = false ]) : void
Parameters
$string : string

Text to display

$return : null|bool = false
Return values
void

Search results