Peridot\Reporter\AbstractBaseReporter::color PHP Method

color() public method

Given a color name, colorize the provided text in that color
public color ( $key, $text ) : string
$key
$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']);
    }