src/TerminalInfo.php
static public function echoWithColor($text, $color, $backgroundColor = null) {
        if (static::isColorsCapable())
            fwrite(STDOUT, $backgroundColor . $color . $text . self::RESET_COLOR);
        else
            fwrite(STDOUT, $text);
    }
static public function echoWithColor($text, $color, $backgroundColor = null) {
        if (static::isColorsCapable())
            fwrite(STDOUT, $backgroundColor . $color . $text . self::RESET_COLOR);
        else
            fwrite(STDOUT, $text);
    }
Outputs text with background/foreground color
@param string $text
@param string $color
@param string|null $backgroundColor