public function color($color = null, $style = null, $background = null) // {{{
    {
        $colors = $this->getColorCodes();
        if (is_array($color)) {
            $style      = isset($color['style']) ? $color['style'] : null;
            $background = isset($color['background']) ? $color['background'] : null;
            $color      = isset($color['color']) ? $color['color'] : null;
        }

        if ($color == 'reset') {
            return "\033[0m";
        }

        $code = array();
        if (isset($style)) {
            $code[] = $colors['style'][$style];
        }

        if (isset($color)) {
            $code[] = $colors['color'][$color];
        }

        if (isset($background)) {
            $code[] = $colors['background'][$background];
        }

        if (empty($code)) {
            $code[] = 0;
        }

        $code = implode(';', $code);
        return "\033[{$code}m";
    }
public function color($color = null, $style = null, $background = null) // {{{
    {
        $colors = $this->getColorCodes();
        if (is_array($color)) {
            $style      = isset($color['style']) ? $color['style'] : null;
            $background = isset($color['background']) ? $color['background'] : null;
            $color      = isset($color['color']) ? $color['color'] : null;
        }

        if ($color == 'reset') {
            return "\033[0m";
        }

        $code = array();
        if (isset($style)) {
            $code[] = $colors['style'][$style];
        }

        if (isset($color)) {
            $code[] = $colors['color'][$color];
        }

        if (isset($background)) {
            $code[] = $colors['background'][$background];
        }

        if (empty($code)) {
            $code[] = 0;
        }

        $code = implode(';', $code);
        return "\033[{$code}m";
    }
public function color ( $ color = null , $ style = null , $ background = null ) // {{{ { $ colors = $ this -> getColorCodes ( ) ; if ( is_array ( $ color ) ) { $ style = isset ( $ color [ 'style' ] ) ? $ color [ 'style' ] : null ; $ background = isset ( $ color [ 'background' ] ) ? $ color [ 'background' ] : null ; $ color = isset ( $ color [ 'color' ] ) ? $ color [ 'color' ] : null ; } if ( $ color == 'reset' ) { return "\033[0m" ; } $ code = array ( ) ; if ( isset ( $ style ) ) { $ code [ ] = $ colors [ 'style' ] [ $ style ] ; } if ( isset ( $ color ) ) { $ code [ ] = $ colors [ 'color' ] [ $ color ] ; } if ( isset ( $ background ) ) { $ code [ ] = $ colors [ 'background' ] [ $ background ] ; } if ( empty ( $ code ) ) { $ code [ ] = 0 ; } $ code = implode ( ';' , $ code ) ; return "\033[{$code}m" ; }
Returns an ANSI-Controlcode

Takes 1 to 3 Arguments: either 1 to 3 strings containing the name of the
FG Color, style and BG color, or one array with the indices color, style
or background.

@param mixed  $color      Optional.
Either a string with the name of the foreground
color, or an array with the indices 'color',
'style', 'background' and corresponding names as
values.
@param string $style      Optional name of the style
@param string $background Optional name of the background color

@return string
Returns an ANSI - Controlcode