Library/Phalcon/Script/Color.php
public static function colorize($string, $fg = null, $at = null, $bg = null)
    {
        // Shell not supported, exit early
        if (!static::isSupportedShell()) {
            return $string;
        }

        $colored = '';

        // Check if given foreground color is supported
        if (isset(static::$_fg[$fg])) {
            $colored .= "\033[" . static::$_fg[$fg] . "m";
        }

        // Check if given background color is supported
        if (isset(static::$_bg[$bg])) {
            $colored .= "\033[" . static::$_bg[$bg] . "m";
        }

        // Check if given attribute is supported
        if (isset(static::$_at[$at])) {
            $colored .= "\033[" . static::$_at[$at] . "m";
        }

        // Add string and end coloring
        $colored .=  $string . "\033[0m";

        return $colored;
    }
public static function colorize($string, $fg = null, $at = null, $bg = null)
    {
        // Shell not supported, exit early
        if (!static::isSupportedShell()) {
            return $string;
        }

        $colored = '';

        // Check if given foreground color is supported
        if (isset(static::$_fg[$fg])) {
            $colored .= "\033[" . static::$_fg[$fg] . "m";
        }

        // Check if given background color is supported
        if (isset(static::$_bg[$bg])) {
            $colored .= "\033[" . static::$_bg[$bg] . "m";
        }

        // Check if given attribute is supported
        if (isset(static::$_at[$at])) {
            $colored .= "\033[" . static::$_at[$at] . "m";
        }

        // Add string and end coloring
        $colored .=  $string . "\033[0m";

        return $colored;
    }
public static function colorize ( $ string , $ fg = null , $ at = null , $ bg = null ) { // Shell not supported, exit early if ( ! static :: isSupportedShell ( ) ) { return $ string ; } $ colored = '' ; // Check if given foreground color is supported if ( isset ( static :: $ _fg [ $ fg ] ) ) { $ colored .= "\033[" . static :: $ _fg [ $ fg ] . "m" ; } // Check if given background color is supported if ( isset ( static :: $ _bg [ $ bg ] ) ) { $ colored .= "\033[" . static :: $ _bg [ $ bg ] . "m" ; } // Check if given attribute is supported if ( isset ( static :: $ _at [ $ at ] ) ) { $ colored .= "\033[" . static :: $ _at [ $ at ] . "m" ; } // Add string and end coloring $ colored .= $ string . "\033[0m" ; return $ colored ; }
Colorizes the string using provided colors.

@static
@param $string
@param null|integer $fg
@param null|integer $at
@param null|integer $bg

@return string
Colorizes the string using provided colors .