PHPackages                             overtrue/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. overtrue/bash-color

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

overtrue/bash-color
===================

A tool for output styled bash text.

0.0.1(10y ago)12117[1 PRs](https://github.com/overtrue/bash-color/pulls)MITPHPPHP 5.4

Since Aug 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/overtrue/bash-color)[ Packagist](https://packagist.org/packages/overtrue/bash-color)[ RSS](/packages/overtrue-bash-color/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)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)

PHP 扩展包开发
---------

[](#php-扩展包开发)

> 想知道如何从零开始构建 PHP 扩展包？
>
> 请关注我的实战课程，我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package)

License
=======

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.8% 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

Unknown

Total

1

Last Release

3924d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c507e57eab402e81335012357b7d7df6c5cafda3073adcc94b475037127d263f?d=identicon)[overtrue](/maintainers/overtrue)

---

Top Contributors

[![overtrue](https://avatars.githubusercontent.com/u/1472352?v=4)](https://github.com/overtrue "overtrue (28 commits)")[![wizarot](https://avatars.githubusercontent.com/u/4525203?v=4)](https://github.com/wizarot "wizarot (4 commits)")[![summerblue](https://avatars.githubusercontent.com/u/324764?v=4)](https://github.com/summerblue "summerblue (1 commits)")

### Embed Badge

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

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

###  Alternatives

[bitrix-expert/bbc

Bitrix basis components

10242.9k1](/packages/bitrix-expert-bbc)[refinery29/league-lazy-event

Provides a LazyListener for use with league/event which allows for lazy fetching of actual listeners.

1523.3k](/packages/refinery29-league-lazy-event)[mage2/module-installer

A composer plugin, to help install modules for AvoREd e commerce applications.

132.0k](/packages/mage2-module-installer)

PHPackages © 2026

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