class ColorStyle (View source)

Class ColorStyle

Methods

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

Constructor

string
__toString()

Convert to a string.

static ColorStyle
fromString(string $string)

Create a color style from a parameter string.

string
getStyle()

Get the translated color code.

string
getKnownColors()

Get the known colors.

array
getKnownOptions()

Get the known options.

Details

at line line 98
__construct(string $fg = '', string $bg = '', array $options = array())

Constructor

Parameters

string $fg Foreground color.
string $bg Background color.
array $options Style options.

Exceptions

InvalidArgumentException

at line line 153
string __toString()

Convert to a string.

Return Value

string

at line line 170
static ColorStyle fromString(string $string)

Create a color style from a parameter string.

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

Parameters

string $string The parameter string.

Return Value

ColorStyle Instance of $this to allow chaining.

Exceptions

RuntimeException

at line line 217
string getStyle()

Get the translated color code.

Return Value

string

at line line 246
string getKnownColors()

Get the known colors.

Return Value

string

at line line 258
array getKnownOptions()

Get the known options.

Return Value

array