PHPackages                             devjuliocesar/bash-color - 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. devjuliocesar/bash-color

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

devjuliocesar/bash-color
========================

A tool for output styled bash text.

1.0.1(8y ago)0164MITPHPPHP ^7.0

Since Aug 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/DevJuliocesar/bash-color)[ Packagist](https://packagist.org/packages/devjuliocesar/bash-color)[ RSS](/packages/devjuliocesar-bash-color/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (4)Used By (0)

BashColor
=========

[](#bashcolor)

Generate command line colorized text. 给命令行文字添加前景/背景色、以及修饰效果。

[![Build Status](https://camo.githubusercontent.com/9e759b096b9b0fccd24ee788aabaaf0fcf43e19b2afa943c3ff24e2b994d7361/68747470733a2f2f7472617669732d63692e6f72672f6f766572747275652f626173682d636f6c6f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/overtrue/bash-color)[![Latest Stable Version](https://camo.githubusercontent.com/3519207c9b40d16c1214257789ad8399380ca62c534ee988ea77fa7476e25c51/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f626173682d636f6c6f722f762f737461626c652e737667)](https://packagist.org/packages/overtrue/bash-color)[![Latest Unstable Version](https://camo.githubusercontent.com/3ef5274b7690e0ddce1d1c4a22ebe64ec0f12772ab6ff49d77d29a540f98cca0/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f626173682d636f6c6f722f762f756e737461626c652e737667)](https://packagist.org/packages/overtrue/bash-color)[![Code Coverage](https://camo.githubusercontent.com/7c34c0103e7b8718560612e8649209f4bfff8a0eed1e7605039ec90ee24fa4fd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f766572747275652f626173682d636f6c6f722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/overtrue/bash-color/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/21c604687a7ff2eb87ae94d07ff8a15f13172753f9bcbb5294ce323e1adbfdbc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f766572747275652f626173682d636f6c6f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/overtrue/bash-color/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/a6df3a887a0bff99f2c655e0320e20d59dfa48b3da1dc9d822c6d2fdfd09470d/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f626173682d636f6c6f722f646f776e6c6f616473)](https://packagist.org/packages/overtrue/bash-color)[![License](https://camo.githubusercontent.com/6fd2a24988fd657ac965285838b4210f557ecd3ccdcc423f92a2881aafd1cfc8/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f626173682d636f6c6f722f6c6963656e7365)](https://packagist.org/packages/overtrue/bash-color)

Installing
==========

[](#installing)

```
$ composer require "overtrue/bash-color"
```

Usage
=====

[](#usage)

```
use Overtrue\BashColor\BashColor;

echo BashColor::render('Are you sure ? [Y/n]:'), "\n";
echo BashColor::render('hello world!'), "\n";
echo BashColor::render('yes!'), "\n";
echo BashColor::render('ugly!'), "\n";
```

result:

[![qq20150822-1 2x](https://cloud.githubusercontent.com/assets/1472352/9413936/9decd54a-4867-11e5-8d0b-1d27da954cc3.jpg)](https://cloud.githubusercontent.com/assets/1472352/9413936/9decd54a-4867-11e5-8d0b-1d27da954cc3.jpg)

### Attributes

[](#attributes)

- `fg` foreground color.
- `bg` background color.
- `opt` option.

### foreground

[](#foreground)

```
'default'       // Default (usually green, white or light gray)
'black'         // Black
'red'           // Red (don't use with green background)
'green'         // Green
'yellow'        // Yellow
'blue'          // Blue
'magenta'       // Magenta/Purple
'purple'        // Magenta/Purple
'cyan'          // Cyan
'light_gray'    // Light Gray
'dark_gray'     // Dark Gray
'light_red'     // Light Red
'light_green'   // Light Green
'light_yellow'  // Light Yellow
'light_blue'    // Light Blue
'light_magenta' // Light Magenta/pink
'light_pink'    // Light Magenta/pink
'light_cyan'    // Light Cyan
'white'         // White

```

### background

[](#background)

```
'default'       // Default background color (usually black or blue)
'black'         // Black
'red'           // Red
'green'         // Green
'yellow'        // Yellow
'blue'          // Blue
'magenta'       // Magenta/Purple
'PURPLE'        // Magenta/Purple
'cyan'          // Cyan
'light_gray'    // Light Gray (don't use with white foreground)
'dark_gray'     // Dark Gray (don't use with black foreground)
'light_red'     // Light Red
'light_green'   // Light Green (don't use with white foreground)
'light_yellow'  // Light Yellow (don't use with white foreground)
'light_blue'    // Light Blue (don't use with light yellow foreground)
'light_magenta' // Light Magenta/Pink (don't use with light foreground)
'light_cyan'    // Light Cyan (don't use with white foreground)
'white'         // White (don't use with light foreground)

```

### options

[](#options)

```
'none'       // Reset/Remove all option
'bold'       // Bold/Bright
'bright'     // Bold/Bright
'dim'        // Dim
'underlined' // Underlined
'blink'      // Blink
'reverse'    // Reverse/invert
'invert'     // Reverse/invert
'hidden'     // Hidden

```

Reference
=========

[](#reference)

[Bash tips: Colors and formatting](http://misc.flogisoft.com/bash/tip_colors_and_formatting)

License
=======

[](#license)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 69.2% 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 ~440 days

Total

3

Last Release

3041d ago

Major Versions

0.0.1 → 1.0.02018-01-17

PHP version history (2 changes)0.0.1PHP 5.4

1.0.0PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3401bc9ba99d23fd70613f1ad17f76d4b74a012e705319815866408ee76221be?d=identicon)[DevJuliocesar](/maintainers/DevJuliocesar)

---

Top Contributors

[![overtrue](https://avatars.githubusercontent.com/u/1472352?v=4)](https://github.com/overtrue "overtrue (27 commits)")[![DevJuliocesar](https://avatars.githubusercontent.com/u/12390096?v=4)](https://github.com/DevJuliocesar "DevJuliocesar (8 commits)")[![wizarot](https://avatars.githubusercontent.com/u/4525203?v=4)](https://github.com/wizarot "wizarot (4 commits)")

---

Tags

promptbashcolorizedconsole style

### Embed Badge

![Health badge](/badges/devjuliocesar-bash-color/health.svg)

```
[![Health](https://phpackages.com/badges/devjuliocesar-bash-color/health.svg)](https://phpackages.com/packages/devjuliocesar-bash-color)
```

###  Alternatives

[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)[titasgailius/terminal

Terminal is an Elegent wrapper around Symfony's Process component.

512340.9k11](/packages/titasgailius-terminal)[alecrabbit/php-console-spinner

Extremely flexible spinner for \[async\] php cli applications

24032.0k2](/packages/alecrabbit-php-console-spinner)[stepanenko3/nova-command-runner

Laravel Nova tool for running Artisan and bash(shell) commands.

36983.0k](/packages/stepanenko3-nova-command-runner)[bvanhoekelen/terminal-style

Return your terminal message in style! Change the text style, text color and text background color form the terminal interface with ANSI color codes. The terminal style tool support Laravel and Composer.

19784.4k2](/packages/bvanhoekelen-terminal-style)

PHPackages © 2026

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