Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/runekaagaard/php-termcolor

Colors on the command line with PHP 5+. An (almost) direct port from Python.
https://github.com/runekaagaard/php-termcolor

Last synced: 2 months ago
JSON representation

Colors on the command line with PHP 5+. An (almost) direct port from Python.

Awesome Lists containing this project

README

        

## About ##
An (almost) direct port of http://pypi.python.org/pypi/termcolor to PHP. See
the phpdoc in
[termcolor.php](https://github.com/runekaagaard/php-termcolor/blob/master/termcolor.php)
for detailed documentation.

## Supplied functions ##
php-termcolor provides the following functions:

- `tc_colored()`: Returns text formatted with color, background color and/or
attributes.
- `tcechon()`: Echos text formatted with color, background color and/or
attributes. Adds a new line at the end.
- `tcecho()`: Echos text formatted with color, background color and/or
attributes.

The arguments for all three functions are the same. The first is the text to
be colored. Thereafter an arbitrary number of foreground colors, background
colors and text style attributes can be given. The available choices are:

```
Available text colors:
red, green, yellow, blue, magenta, cyan, white.
Available text highlights:
on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan,
on_white.
Available attributes:
bold, dark, underline, blink, reverse, concealed.
```

## Examples ##

```php