norwichtech/php-cli-colours

A small library for using colours in CLI scripts

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

Installs: 2 570

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 1

pkg:composer/norwichtech/php-cli-colours

1.2.1 2017-09-27 12:07 UTC

This package is not auto-updated.

Last update: 2020-11-28 08:39:36 UTC


README

I like my CLI scripts to be colourful and with this library I hope to achieve said colours

Example usage

include 'BashColours.php';
$bashColours=new \NorwichTech\CLIColours\BashColours();

echo "I am writing a nice CLI script and ".$bashColours->formatString("BANG!", 'red')." I need exciting things to happen\n";

echo $bashColours->formatString("But now everything is fine and stuff",'default','green');

Or now you can change forecolor with a big heap of shortcut functions:

include 'BashColours.php';
$colour=new \NorwichTech\CLIColours\BashColours();

echo $colour->red("red")." and ".$colour->yellow("yellow")." and ".$colour->lightMagenta("pink")." and ".$colour->green("green")."...\n";

The full set of foreground and background colors from this list are implemented:

http://misc.flogisoft.com/bash/tip_colors_and_formatting

Will consider adding bold/italic/blink etc later.