alecrabbit / php-console-colour
Helps to do colored console output.
Fund package maintenance!
Patreon
Installs: 14 203
Dependents: 3
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: >=7.2
- alecrabbit/php-cli-tools: ^0.6
Requires (Dev)
- alecrabbit/php-helpers: ^0.8
- nunomaduro/collision: ^4.2
- phpunit/phpunit: ^8.5
- symfony/var-dumper: ^5.0
- dev-master
- 0.10.1
- 0.10.0
- 0.9.1
- 0.9.0
- 0.9.0-BETA.0
- 0.8.0-BETA.0
- 0.8.0-ALPHA.3
- 0.8.0-ALPHA.2
- 0.8.0-ALPHA.1
- 0.7.0-ALPHA.1
- 0.6.1
- 0.6.0
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.5.0-BETA.1
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.1-BETA.1
- 0.2.0-BETA.1
- 0.1.9-BETA.1
- 0.0.5-ALPHA1
- 0.0.4-RC2
- 0.0.3
- 0.0.2
- 0.0.1
- dev-develop
- dev-dependabot/add-v2-config-file
- dev-new_version
This package is auto-updated.
Last update: 2024-10-29 04:59:03 UTC
README
Installation
composer require alecrabbit/php-console-colour
Themes::class
Usage
$themes = new Themes(); echo $themes->red('This text is red.') . PHP_EOL; echo $themes->underlinedBold('This text is underlined and bold.') . PHP_EOL;
Basically methods of this class just applying corresponding escape sequences to $text
// "\033[2;3mThis text is dark and italic.\033[0m" $colorized = $themes->darkItalic('This text is dark and italic.')
Methods
Note: not all methods could be listed.
/** * @method comment(string $text) * @method error(string $text) * @method info(string $text) * * @method yellow(string $text) * @method red(string $text) * @method green(string $text) * @method cyan(string $text) * @method magenta(string $text) * * @method italic(string $text) * @method bold(string $text) * @method dark(string $text) * @method darkItalic(string $text) * @method white(string $text) * @method whiteBold(string $text) * @method underlined(string $text) * @method underlinedBold(string $text) * @method underlinedItalic(string $text) */
Note: new methods will be added. Pull requests are welcomed.
Define your own themes
Themes::class
How to extend?
ConsoleColor::class
// TODO
XTerm 256 Colors Table
Examples
Note: actual colors depend on your terminal color scheme