chonla / colr
Command line colorizer
dev-master
2015-09-14 16:16 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.8.*
This package is auto-updated.
Last update: 2025-02-20 18:15:33 UTC
README
Command line colorizer
API
$colr = new Colr; // or $colr = new Colr(array( "ok" => array("fg" => Colr::BLACK, "bg" => Colr::GREEN) ));
Use fg()
to set foreground color:
$colr->fg(Colr::GREEN);
Use bg()
to set background color:
$colr->bg(Colr::GREEN);
Use set()
to select predefined preset:
$colr = new Colr(array( "ok" => array("fg" => Colr::BLACK, "bg" => Colr::GREEN) )); $colr->set("ok");
Use write()
to echo some text:
$colr->write("hello");
Use writeln()
to echo some text with new line:
$colr->writeln("hello");
Method chaining:
$colr->fg(Color::GREEN)->write("hello");