Command line colorizer
$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");