ColorStyle

Class defining ANSI-color styles for command line output

final deprecated
since

4.0.0

deprecated

5.0 Use the joomla/console package instead

Methods

__construct

Constructor

__construct(string $fg = '', string $bg = '', array $options = array()) 
since

4.0.0

throws

\InvalidArgumentException

Arguments

$fg

stringForeground color.

$bg

stringBackground color.

$options

arrayStyle options.

__toString

Convert to a string.

__toString() : string
since

4.0.0

Response

string

fromString

Create a color style from a parameter string.

fromString(string $string) : $this
static

Example: fg=red;bg=blue;options=bold,blink

since

4.0.0

throws

\RuntimeException

Arguments

$string

stringThe parameter string.

Response

$this

getKnownColors

Get the known colors.

getKnownColors() : array<mixed,string>
since

4.0.0

Response

array<mixed,string>

getKnownOptions

Get the known options.

getKnownOptions() : array<mixed,string>
since

4.0.0

Response

array<mixed,string>

getStyle

Get the translated color code.

getStyle() : string
since

4.0.0

Response

string

Properties

knownColors

Known colors

static
since

4.0.0

Type(s)

array

knownOptions

Known styles

static
since

4.0.0

Type(s)

array

fgBase

Foreground base value

static
since

4.0.0

Type(s)

integer

bgBase

Background base value

static
since

4.0.0

Type(s)

integer

fgColor

Foreground color

since

4.0.0

Type(s)

integer

bgColor

Background color

since

4.0.0

Type(s)

integer

options

Array of style options

since

4.0.0

Type(s)

array