PHP Class Colors\Color

Mostra file Open project: kevinlebrun/colors.php Class Usage Examples

Protected Properties

Property Type Description
$initial
$isStyleForced
$styles italic and blink may not work depending of your terminal
$userStyles
$wrapped

Public Methods

Method Description
__call ( $method, $args )
__construct ( $string = '' )
__get ( $name )
__invoke ( $string )
__toString ( )
apply ( $style, $text = null )
are256ColorsSupported ( )
bg ( $color, $text = null )
center ( $width = 80, $text = null )
clean ( $text = null )
colorize ( $text = null )
fg ( $color, $text = null )
highlight ( $color, $text = null )
isAValidStyleName ( $name )
isStyleForced ( )
isSupported ( ) : boolean Returns true if the stream supports colorization.
reset ( )
setForceStyle ( $force )
setTheme ( array $theme )
setUserStyles ( array $userStyles )
strip ( $text = null )

Protected Methods

Method Description
applyStyle ( $style, $text )
applyUserStyle ( $userStyle, $text )
buildEscSeq ( $style )
colorizeText ( $text )
isStyleExists ( $style )
isUserStyleExists ( $style )
replaceStyle ( $matches )
setInternalState ( $string )
shouldStylize ( )
stripColors ( $text )
stylize ( $style, $text )

Method Details

__call() public method

public __call ( $method, $args )

__construct() public method

public __construct ( $string = '' )

__get() public method

public __get ( $name )

__invoke() public method

public __invoke ( $string )

__toString() public method

public __toString ( )

apply() public method

public apply ( $style, $text = null )

applyStyle() protected method

protected applyStyle ( $style, $text )

applyUserStyle() protected method

protected applyUserStyle ( $userStyle, $text )

are256ColorsSupported() public method

bg() public method

public bg ( $color, $text = null )

buildEscSeq() protected method

protected buildEscSeq ( $style )

center() public method

public center ( $width = 80, $text = null )

clean() public method

public clean ( $text = null )

colorizeText() protected method

protected colorizeText ( $text )

fg() public method

public fg ( $color, $text = null )

highlight() public method

public highlight ( $color, $text = null )

isAValidStyleName() public method

public isAValidStyleName ( $name )

isStyleExists() protected method

protected isStyleExists ( $style )

isStyleForced() public method

public isStyleForced ( )

isSupported() public method

Colorization is disabled if not supported by the stream: - Windows without Ansicon, ConEmu or Babun - non tty consoles
public isSupported ( ) : boolean
return boolean true if the stream supports colorization, false otherwise

isUserStyleExists() protected method

protected isUserStyleExists ( $style )

replaceStyle() protected method

protected replaceStyle ( $matches )

reset() public method

public reset ( )

setForceStyle() public method

public setForceStyle ( $force )

setInternalState() protected method

protected setInternalState ( $string )

setTheme() public method

Deprecation:
public setTheme ( array $theme )
$theme array

setUserStyles() public method

public setUserStyles ( array $userStyles )
$userStyles array

shouldStylize() protected method

protected shouldStylize ( )

strip() public method

public strip ( $text = null )

stripColors() protected method

protected stripColors ( $text )

stylize() protected method

protected stylize ( $style, $text )

Property Details

$initial protected_oe property

protected $initial

$isStyleForced protected_oe property

protected $isStyleForced

$styles protected_oe property

italic and blink may not work depending of your terminal
protected $styles

$userStyles protected_oe property

protected $userStyles

$wrapped protected_oe property

protected $wrapped