PHP Bash 文字彩色组件:overtrue/bash-color
又没忍住造了一个轮子,与 symfony 的 Console 组件中的彩色部分类似:
use Overtrue\BashColor\BashColor;
echo BashColor::render('<fg=green>Are you sure ?</><fg=yellow> [Y/n]:</>'), "\n";
echo BashColor::render('<fg=green;opt=underlined>yes!</>'), "\n";
echo BashColor::render('<fg=red>hello world!</>'), "\n";
echo BashColor::render('<fg=cyan;opt=bold;bg=red>ugly!</>'), "\n";
结果:
欢迎各位 star: https://github.com/overtrue/bash-color
推荐文章: