hhpack / color
Hack 的颜色包
1.3.0
2019-04-11 03:29 UTC
Requires
- hhvm: >=3.21.0
- hhvm/hhvm-autoload: ^2.0
- hhvm/hsl: ^4.1
Requires (Dev)
- facebook/fbexpect: ^2.5
- hhvm/hacktest: ^1.5
This package is auto-updated.
Last update: 2024-09-15 19:19:53 UTC
README
基本用法
用户可以通过指定颜色输出到 stdout。
Color::fromColor(ForegroundColor::White) ->background(BackgroundColor::Green) ->println('%s succeeded.', 'Color package example');
或者
$color = Color::fromColor(ForegroundColor::White) ->background(BackgroundColor::Green); $color('%s succeeded.', 'Color package example');
应用样式
用户可以使用 applyTo 方法将样式应用到文本上。
$text = Color::fromColor(ForegroundColor::White) ->background(BackgroundColor::Green) ->applyTo('target text'); echo $text;
文本的自定义样式
用户可以获取加粗和下划线。
Color::fromColor(ForegroundColor::White) ->addStyle(StyleType::Bold) ->addStyle(StyleType::Underlined) ->println('%s + %s', 'bold', 'underlined');
运行测试
您可以使用以下命令运行测试。
composer install
composer test