code: public static function apply($text, $foreground = '', $background = '')
      {
          try {
              $style = new OutputFormatterStyle();
              if ($foreground != '') {
                  $style->setForeground($foreground);
              }
              if ($background != '') {
                  $style->setBackground($background);
              }
              return $style->apply($text);
          } catch (\Exception $e) {
              return $text;
          }
      }
docs: Apply foreground and background color.
  
  @param string $text
  @param string $foreground Default ''.
  @param string $background Default ''.
  @return string