A PHP terminal styling library inspired by Chalk
- Support 16 colors, 256 colors and Truecolor (16m colors) mode.
- Support style chaining.
- Support style nesting.
Through composer
composer require tdtrung17693/php-chalk
Manually:
Just download/clone this repo
See examples
to know more about how to use this library.
print $chalk->bold->green("Bold Green");
print "\n";
print $chalk->underscore->color220->bgColor20("Blink Foreground 220 Background 20");
print "\n";
print $chalk->rgb(200, 20, 100)->inverse("Inverse");
// Style nesting
print $chalk->red("Red then", $chalk->bold->green("bold and green then"), $chalk->reset("back to normal\n"));
Screenshot:
Example: $chalk->bgGreen->red->bold('Background green red bold text')
Return true if the corresponding feature is supported.
reset
,bold
,dim
,underscore
,italic
,strikethrough
,blink
.red
,green
,yellow
,blue
,magenta
,cyan
,white
lightGray
,darkGray
,lightRed
,lightGreen
,lightYellow
,lightBlue
,lightMagenta
,lightCyan
- Each of the color styles above with the prefix
bg
Feel free to contribute by forking or making suggestions.