PHPackages                             web64/laravel-cli-colors - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. web64/laravel-cli-colors

ActiveLibrary[CLI &amp; Console](/categories/cli)

web64/laravel-cli-colors
========================

Laravel package for generating CLI output with awesome colors!

v0.20(5y ago)1311.8k↓27.3%7[2 issues](https://github.com/web64/laravel-cli-colors/issues)2MITPHP

Since Feb 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/web64/laravel-cli-colors)[ Packagist](https://packagist.org/packages/web64/laravel-cli-colors)[ RSS](/packages/web64-laravel-cli-colors/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (7)Used By (2)

Laravel CLI COLORS
==================

[](#laravel-cli-colors)

 [![](https://camo.githubusercontent.com/a857fc866abc4497674210fd6ee248aaa33e24d3f08afd10cd5afb580e1df169/687474703a2f2f63646e2e77656236342e636f6d2f6e6c702d6e6f727761792f6c61726176656c2d636f6c6f72732d322e706e67)](https://camo.githubusercontent.com/a857fc866abc4497674210fd6ee248aaa33e24d3f08afd10cd5afb580e1df169/687474703a2f2f63646e2e77656236342e636f6d2f6e6c702d6e6f727761792f6c61726176656c2d636f6c6f72732d322e706e67)

Laravel CLI Colors is a simple package, based on the [jakub-onderka/php-console-color](https://github.com/JakubOnderka/PHP-Console-Color) library, that makes it easy to output text in various colors and styles.

Laravel already comes with some built in styles for the Command class but I often output debug information in other classes and also wanted more flexibility in how to style the output, so I created this package.

Note that the colors and styling features available will depend on your OS and console settings.

Installation
------------

[](#installation)

```
composer require web64/laravel-cli-colors
```

To publish the colors.php config file run

```
php artisan vendor:publish --provider="Web64\Colors\ColorsServiceProvider" --tag="config"
```

Run this command to see a sample of how use can use Laravel CLI Colors.

```
php artisan colors:test
```

Quick Start
-----------

[](#quick-start)

```
use Web64\Colors\Facades\Colors;

Colors::red('Red Text');
```

Default Colors
--------------

[](#default-colors)

### Text Colors:

[](#text-colors)

default, black, red, green, yellow, blue, magenta, cyan, light\_gray, dark\_gray, light\_red, light\_green, light\_yellow, light\_blue, light\_magenta, light\_cyan, white

### Background Colors:

[](#background-colors)

bg\_default, bg\_black, bg\_red, bg\_green, bg\_yellow, bg\_blue, bg\_magenta, bg\_cyan, bg\_white, bg\_light\_gray, bg\_dark\_gray, bg\_light\_red, bg\_light\_green, bg\_light\_yellow, bg\_light\_blue, bg\_light\_magenta, bg\_light\_cyan

```
Colors::light_blue('Light blue text');
Colors::bg_light_blue('Light blue background');
```

Custom Styles
-------------

[](#custom-styles)

In the colors.php configuration file you can define your own custom styles. The key of the array will be the name of the static method on the Colors facade and the value is an array of styles to be applied.

```
// config.php
return [
    'myStyle' => ['bold','blue', 'bg_white'],
    ...
];
```

```
Colors::myStyle('Bold blue text with white background');
```

Pre-defined styles
==================

[](#pre-defined-styles)

The colors.php config file already has a list of pre-defined styles. Feel free to change, remove or add styles to this configuration file.

```
// Laravel-style output
Colors::info('Green text');
Colors::question('Black text on light blue background');

// Model changed styles
Colors::created("Green bg to indicate model was created");
Colors::updated("Yellow bg to indicate model was updated");
Colors::deleted("Red bg to indicate model was deleted");
```

View &amp; Validate Custom Styles
=================================

[](#view--validate-custom-styles)

Run this command to see how your custom styles look and if they are any errors.

```
php artisan colors:test --config
```

Inline Styles
-------------

[](#inline-styles)

To test out styles quickly you can add several styles inline and separate them with a double underscore (\_\_).

```
Colors::bold__underline__reverse__blue__bg_light_gray("Text..");
```

When you find a style you like you, can add them to the colors.php config.

Formatting
----------

[](#formatting)

You can format the text with bold, underline, italic and reverse.

```
Colors::bold()->red('Bold red text');
Colors::underline()->blue('Underlined blue text');
Colors::italic()->green('Italic green text');
Colors::reverse()->default('Reversed default text and background color');
```

Adding nobr() prevents a newline character from being added, so you can change styles on the same line.

```
Colors::nobr()->red('U');
Colors::nobr()->white('S');
Colors::blue('A');
```

Shortcuts
---------

[](#shortcuts)

Instead of 'light\_' and 'dark\_' you can just prefix 'l' or 'd'.

For bold, underline and reverse, you can use shortcuts: 'b', 'u' and 'rev'

```
Colors::b__u__dgray__bg_lcyan('Text');
// Same as
Colors::bold__underline__dark_gray__bg_light_cyan('Text');
```

Helper
------

[](#helper)

A helper function is available if you don't want to use the facade.

The first argument is a string or array of styles, with the text to output as the second argument.

```
colors('red', 'Hello World!');
colors('b__u__red', 'Hello World!');
colors(['bold', 'underline', 'red'], 'Hello World!');
```

Fun Stuff
---------

[](#fun-stuff)

Display random colors for each character using the rainbow() function.

```
// Random text colors:
Colors::rainbow('Text');

// Random background colors:
Colors::reverse()->rainbow('Text');
```

Samples
-------

[](#samples)

[![Default Config](https://camo.githubusercontent.com/d142e987c7db8e807f9102cd847a3c106ec72cbdd267c116ee4f8491e3c3108d/68747470733a2f2f63646e2e77656236342e636f6d2f6769746875622f636f6c6f72732d636f6e6669672e706e67)](https://camo.githubusercontent.com/d142e987c7db8e807f9102cd847a3c106ec72cbdd267c116ee4f8491e3c3108d/68747470733a2f2f63646e2e77656236342e636f6d2f6769746875622f636f6c6f72732d636f6e6669672e706e67)[![Text Colors](https://camo.githubusercontent.com/52cee1517e027dc220c36e51368fcd68a04ed0dbbf94f74625fec6699e6ebcfe/68747470733a2f2f63646e2e77656236342e636f6d2f6769746875622f636f6c6f72732d746578742e706e67)](https://camo.githubusercontent.com/52cee1517e027dc220c36e51368fcd68a04ed0dbbf94f74625fec6699e6ebcfe/68747470733a2f2f63646e2e77656236342e636f6d2f6769746875622f636f6c6f72732d746578742e706e67)[![Background Colors](https://camo.githubusercontent.com/778a7503c07ef3dc5629652ad3ccafc9d546ad94c5b780375d33aabc21a66c72/68747470733a2f2f63646e2e77656236342e636f6d2f6769746875622f636f6c6f72732d6261636b67726f756e642e706e67)](https://camo.githubusercontent.com/778a7503c07ef3dc5629652ad3ccafc9d546ad94c5b780375d33aabc21a66c72/68747470733a2f2f63646e2e77656236342e636f6d2f6769746875622f636f6c6f72732d6261636b67726f756e642e706e67)

Contribute
----------

[](#contribute)

Let me know if you have any ideas on how to improve this package!

Leave an issue here or reach out to me on Twitter [@OlavHjertaker](https://twitter.com/OlavHjertaker)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~148 days

Total

5

Last Release

2059d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c6dfe4497360d44db08cf0906561e71a95b1b2308089ebcb17e88d8f10ce130?d=identicon)[web64](/maintainers/web64)

---

Top Contributors

[![web64](https://avatars.githubusercontent.com/u/76733?v=4)](https://github.com/web64 "web64 (20 commits)")

---

Tags

artisanlaravellaravel-5-packagephp

### Embed Badge

![Health badge](/badges/web64-laravel-cli-colors/health.svg)

```
[![Health](https://phpackages.com/badges/web64-laravel-cli-colors/health.svg)](https://phpackages.com/packages/web64-laravel-cli-colors)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
