chonla/colr

Command line colorizer

dev-master 2015-09-14 16:16 UTC

This package is auto-updated.

Last update: 2024-05-20 16:50:10 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");

license

MIT: http://chonla.mit-license.org/