private static function Kint_Decorators_Plain::_colorize in Devel 8
Same name and namespace in other branches
- 8.2 kint/kint/decorators/plain.php \Kint_Decorators_Plain::_colorize()
4 calls to Kint_Decorators_Plain::_colorize()
- Kint_Decorators_Plain::decorateTrace in kint/
kint/ decorators/ plain.php - Kint_Decorators_Plain::wrapEnd in kint/
kint/ decorators/ plain.php - Kint_Decorators_Plain::_drawHeader in kint/
kint/ decorators/ plain.php - Kint_Decorators_Plain::_title in kint/
kint/ decorators/ plain.php
File
- kint/
kint/ decorators/ plain.php, line 163
Class
Code
private static function _colorize($text, $type, $nlAfter = true) {
$nlAfter = $nlAfter ? PHP_EOL : '';
switch (Kint::enabled()) {
case Kint::MODE_PLAIN:
if (!self::$_enableColors) {
return $text . $nlAfter;
}
switch ($type) {
case 'value':
$text = "<i>{$text}</i>";
break;
case 'type':
$text = "<b>{$text}</b>";
break;
case 'title':
$text = "<u>{$text}</u>";
break;
}
return $text . $nlAfter;
break;
case Kint::MODE_CLI:
if (!self::$_enableColors) {
return $text . $nlAfter;
}
$optionsMap = array(
'title' => "\33[36m",
# cyan
'type' => "\33[35;1m",
# magenta bold
'value' => "\33[32m",
);
return $optionsMap[$type] . $text . "\33[0m" . $nlAfter;
break;
case Kint::MODE_WHITESPACE:
default:
return $text . $nlAfter;
break;
}
}