[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/splitbrain/php-cli/src/ -> Colors.php (summary)

(no description)

File Size: 170 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Colors:: (9 methods):
  __construct()
  enable()
  disable()
  isEnabled()
  ptln()
  wrap()
  getColorCode()
  set()
  reset()


Class: Colors  - X-Ref

Class Colors

Handles color output on (Linux) terminals

__construct()   X-Ref
Constructor

Tries to disable colors for non-terminals

enable()   X-Ref
enable color output


disable()   X-Ref
disable color output


isEnabled()   X-Ref

return: bool is color support enabled?

ptln($line, $color, $channel = STDOUT)   X-Ref
Convenience function to print a line in a given color

param: string   $line    the line to print, a new line is added automatically
param: string   $color   one of the available color names
param: resource $channel file descriptor to write to

wrap($text, $color)   X-Ref
Returns the given text wrapped in the appropriate color and reset code

param: string $text string to wrap
param: string $color one of the available color names
return: string the wrapped string

getColorCode($color)   X-Ref
Gets the appropriate terminal code for the given color

param: string $color one of the available color names
return: string color code

set($color, $channel = STDOUT)   X-Ref
Set the given color for consecutive output

param: string $color one of the supported color names
param: resource $channel file descriptor to write to

reset($channel = STDOUT)   X-Ref
reset the terminal color

param: resource $channel file descriptor to write to