Documentation

Colors
in package

Utility class to colour shell

Table of Contents

$background_colors  : mixed
$foreground_colors  : mixed
$hasColorSupport  : mixed
__construct()  : Colors
setup shell colours
getBackgroundColors()  : array<string|int, string>
returns all background color names
getColoredString()  : string
get the colored string
getForegroundColors()  : array<string|int, string>
returns all foreground color names
hasColorSupport()  : bool
test if system has color support

Properties

$background_colors

private mixed $background_colors = array()

$foreground_colors

private mixed $foreground_colors = array()

$hasColorSupport

private mixed $hasColorSupport = null

Methods

getBackgroundColors()

returns all background color names

public getBackgroundColors() : array<string|int, string>
Return values
array<string|int, string>

all background color names

getColoredString()

get the colored string

public getColoredString(string $string[, object $foreground_color = null ][, string $background_color = null ]) : string
Parameters
$string : string

string to be colored

$foreground_color : object = null

color for foreground

$background_color : string = null

color for background

Return values
string

the colored string

getForegroundColors()

returns all foreground color names

public getForegroundColors() : array<string|int, string>
Return values
array<string|int, string>

all foreground color names

hasColorSupport()

test if system has color support

public hasColorSupport() : bool

https://github.com/symfony/console/blob/v5.2.6/Output/StreamOutput.php#L94-L114

MIT license

Return values
bool

Search results