danieljharvey / php-cli-colours
一个用于在CLI脚本中使用颜色的小型库
1.2.0
2017-05-06 17:57 UTC
This package is not auto-updated.
Last update: 2024-09-15 01:05:37 UTC
README
我喜欢我的CLI脚本色彩丰富,使用这个库,我希望实现这样的色彩效果
示例用法
include 'BashColours.php';
$bashColours=new \DanielJHarvey\CLIColours\BashColours();
echo "I am writing a nice CLI script and ".$bashColours->formatString("BANG!", 'red')." I need exciting things to happen\n";
echo $bashColours->formatString("But now everything is fine and stuff",'default','green');
或者现在你可以通过大量快捷函数更改前景色
include 'BashColours.php';
$colour=new \DanielJHarvey\CLIColours\BashColours();
echo $colour->red("red")." and ".$colour->yellow("yellow")." and ".$colour->lightMagenta("pink")." and ".$colour->green("green")."...\n";
此列表中包含的全部前景色和背景色都已实现
http://misc.flogisoft.com/bash/tip_colors_and_formatting
以后会考虑添加粗体、斜体、闪烁等效果。