You are here

public static function shellColours::getColouredOutput in Chaos Tool Suite (ctools) 7

Returns coloured string.

3 calls to shellColours::getColouredOutput()
ctools_drush_export in drush/ctools.drush.inc
Drush callback: export.
ctools_drush_export_info in drush/ctools.drush.inc
Drush callback: Export info.
_ctools_drush_export_view in drush/ctools.drush.inc
View a single object.

File

drush/ctools.drush.inc, line 1004
CTools Drush commands.

Class

shellColours
Class to deal with wrapping output strings with colour formatting for the shell.

Code

public static function getColouredOutput($string, $foreground_colour = NULL, $background_colour = NULL) {
  $coloured_string = "";

  // Check if given foreground colour found.
  if ($foreground_colour) {
    $coloured_string .= "\33[" . self::$foreground_colours[$foreground_colour] . "m";
  }

  // Check if given background colour found.
  if ($background_colour) {
    $coloured_string .= "\33[" . self::$background_colours[$background_colour] . "m";
  }

  // Add string and end colouring.
  $coloured_string .= $string . "\33[0m";
  return $coloured_string;
}