Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/mogria/colorful.php

This tiny PHP Library provides a class to decorate text with ANSI terminal colors and modifiers.
https://github.com/mogria/colorful.php

Last synced: 1 day ago
JSON representation

This tiny PHP Library provides a class to decorate text with ANSI terminal colors and modifiers.

Awesome Lists containing this project

README

        

# colorful.php
This tiny PHP Library provides a class to decorate text with ANSI terminal colors and modifiers. It's a PHP implementation of [this project](https://github.com/timofurrer/colorful) .

***

**Author:** Mogria (Thanks to Timo Furrer for the awesome python module)

**License:** GPLv3 (See `LICENSE`)

# dafuq?

With this Library you can decorate some text with colors and other awesome stuff.

For example:

print(cf::bold_red_on_black("dfgdfg"));
print(cf::black_on_white("Hello World!"));
print(cf::underline("Hello World!"));
print(cf::bold_and_underline_green("Hello World!"));
print(cf::bold_and_underline_green_on_red("Hello World!"));
print(cf::bold_and_underline_and_strikethrough_green_on_red("Hello World!"));
print(cf::strikethrough("dfgsfdg"));

Or if you want to output it directly:

cf_out::bold_red_on_black("dfgdfg");
cf_out::black_on_white("Hello World!");
cf_out::underline("Hello World!");
...

## Available modifiers and colors

### Modifiers:
* reset

* bold

* italic

* underline

* blink

* inverse

* strikethrough

### Forecolors:
* black

* red

* green

* brown

* blue

* magenta

* cyan

* white

* normal

### Backcolors:
* black

* red

* green

* yellow

* blue

* magenta

* cyan

* white

* normal