public static ansiFormat ( string $string, array $format = [] ) : string | ||
$string | string | the string to be formatted |
$format | array | An array containing formatting values. You can pass any of the `FG_*`, `BG_*` and `TEXT_*` constants and also [[xtermFgColor]] and [[xtermBgColor]] to specify a format. |
return | string |
public static function ansiFormat($string, $format = [])
{
$code = implode(';', $format);
return "[0m" . ($code !== '' ? "[" . $code . 'm' : '') . $string . "[0m";
}