chonla / colr
Command line colorizer
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/chonla/colr
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.8.*
This package is auto-updated.
Last update: 2025-10-20 19:44:26 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");