hhpack / color
Color package for Hack
Installs: 471
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Language:Shell
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-12-15 19:46:48 UTC
README
Basic usage
The user can output to stdout by specifying the color.
Color::fromColor(ForegroundColor::White) ->background(BackgroundColor::Green) ->println('%s succeeded.', 'Color package example');
or
$color = Color::fromColor(ForegroundColor::White) ->background(BackgroundColor::Green); $color('%s succeeded.', 'Color package example');
Applying styles
The user can use the applyTo method in order to apply a style to text.
$text = Color::fromColor(ForegroundColor::White) ->background(BackgroundColor::Green) ->applyTo('target text'); echo $text;
Custom style for text
The user can pull the bold and underline.
Color::fromColor(ForegroundColor::White) ->addStyle(StyleType::Bold) ->addStyle(StyleType::Underlined) ->println('%s + %s', 'bold', 'underlined');
Run the test
You can run the test with the following command.
composer install
composer test