Formatter Helper

The Formatter helper provides functions to format the output with colors. You can do more advanced things with this helper than you can in How to Color and Style the Console Output.

The Symfony\Component\Console\Helper\FormatterHelper is included in the default helper set and you can get it by calling :method:`Symfony\\Component\\Console\\Command\\Command::getHelper`:

$formatter = $this->getHelper('formatter');

The methods return a string, which you’ll usually render to the console by passing it to the :method:`OutputInterface::writeln <Symfony\\Component\\Console\\Output\\OutputInterface::writeln>` method.