命令行设置文字颜色(Command Line Text Color)

允许在 xterm、ddterm、linux 等终端下生成带颜色的信息。

  1. <?php
  2.  
  3. use Phalcon\Cli\Color;
  4.  
  5. if (Color::isSupportedShell()) {
  6. echo 'Supported color'.PHP_EOL;
  7. }
  8.  
  9. echo Color::colorize("hello", Color::FG_BLACK, Color::AT_BOLD, Color::BG_BLUE).PHP_EOL;
  10. echo Color::head("hello");
  11. echo Color::error("hello");
  12. echo Color::success("hello");
  13. echo Color::info("hello");

原文: http://www.myleftstudio.com/reference/cli-color.html