\Horde_Cli_Color

Horde_Cli API for basic command-line functionality/checks.

Summary

Methods
Properties
Constants
__construct()
bold()
color()
__call()
background()
format()
remove()
No public properties found
FORMAT_NONE
FORMAT_XTERM
FORMAT_VT100
FORMAT_HTML
_foregroundColors()
_backgroundColors()
$_format
N/A
No private methods found
No private properties found
N/A

Constants

FORMAT_NONE

FORMAT_NONE

No color formatting.

FORMAT_XTERM

FORMAT_XTERM

xterm compatible color formatting.

FORMAT_VT100

FORMAT_VT100

VT100 compatible color formatting.

FORMAT_HTML

FORMAT_HTML

HTML compatible color formatting.

Properties

$_format

$_format : 

The color formatting being used.

One of the FORMAT_* constants.

Type

Methods

__construct()

__construct(integer  $format = null) 

Constructor.

Parameters

integer $format

The color format to use. One of the FORMAT_* constants. Automatically detected by default.

bold()

bold(string  $text) : string

Returns a bold version of $text.

Parameters

string $text

The text to bold.

Returns

string —

The bolded text.

color()

color(string  $color, string  $text) : string

Returns a colored version of $text.

Parameters

string $color

The color to use. One of:

  • normal
  • black
  • bold
  • red
  • green
  • brown
  • blue
  • magenta
  • cyan
  • lightgray
  • white
  • darkgray
  • lightred
  • lightgreen
  • yellow
  • lightblue
  • lightmagenta
  • lightcyan
string $text

The text to print in this color.

Returns

string —

The colored text.

__call()

__call(  $color,   $args) : string

Returns a colored version of $text, with the method name specifying the color:

echo $cliColor->lightred("Foo");

Parameters

$color
$args

Returns

string —

The colored text.

background()

background(string  $color, string  $text) : string

Returns a version of $text with a colored background.

Parameters

string $color

The background color to use.

string $text

The text to print on this background.

Returns

string —

The text with background.

format()

format(string  $foreground, string  $background, string  $text) : string

Returns a version of $text with a colored foreground and background.

Parameters

string $foreground

The foreground color to use.

string $background

The background color to use.

string $text

The text to print in color.

Returns

string —

The colored text.

remove()

remove(string  $text) : string

Removes all color formatting from a text.

Parameters

string $text

A colored text.

Returns

string —

The text with all coloring markup removed.

_foregroundColors()

_foregroundColors() : array

Returns the xterm-compatible foreground color sequences.

Returns

array —

Color sequences.

_backgroundColors()

_backgroundColors() : array

Returns the xterm-compatible background color sequences.

Returns

array —

Color sequences.