/** * Given a color name, colorize the provided text in that * color * * @param $key * @param $text * @return string */ public function color($key, $text) { if (!$this->configuration->areColorsEnabled() || !$this->hasColorSupport()) { return $text; } $color = $this->colors[$key]; return sprintf("%s%s%s", $color['left'], $text, $color['right']); }
/** * Given a color name, colorize the provided text in that * color * * @param $key * @param $text * @return string */ public function color($key, $text) { $colorsEnabled = $this->configuration->areColorsEnabled() && $this->hasColorSupport(); $colorsEnabledExplicit = $this->configuration->areColorsEnabledExplicit(); if (!$colorsEnabled && !$colorsEnabledExplicit) { return $text; } $color = $this->colors[$key]; return sprintf("%s%s%s", $color['left'], $text, $color['right']); }