PHPackages                             simoneast/simple-ansi-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. simoneast/simple-ansi-colors

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

simoneast/simple-ansi-colors
============================

Simple PHP class for converting basic HTML-like color tags into ANSI escape codes for use in console apps and scripts. Auto-detection for Windows/Ansicon users included.

1.0.1(10y ago)543.9k↓48.6%3[1 issues](https://github.com/SimonEast/Simple-Ansi-Colors/issues)10MITPHPPHP &gt;=5.3.0

Since May 26Pushed 10y ago2 watchersCompare

[ Source](https://github.com/SimonEast/Simple-Ansi-Colors)[ Packagist](https://packagist.org/packages/simoneast/simple-ansi-colors)[ Docs](https://github.com/SimonEast/Simple-Ansi-Colors)[ RSS](/packages/simoneast-simple-ansi-colors/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (10)

Simple ANSI Colors in PHP
=========================

[](#simple-ansi-colors-in-php)

Simple PHP class for converting basic HTML-like color tags into ANSI escape codes for use in console apps and scripts.

Can be disabled through a single variable so that no colors are output (such as if the output needs to be piped to another app or script).

Auto-detection for Windows/ANSICON users included. Colors are disabled by default on Windows unless ANSICON is detected.

Version 1.0.1
MIT Licence
Requires PHP 5.3 or above.

How to use
==========

[](#how-to-use)

1. Include the class in your script: `require('simple-ansi-colors.php');`
2. Output some text: `echo Ansi::tagsToColors('Hello World!');`

Note that unlike HTML, there are no closing tags. Simply use `` to return the color to the default. For example...

```
This text will be green. This text will return to the default color.

```

Supported tags
==============

[](#supported-tags)

```

```

Run `php demo.php` to view a sample of all the options available. In consoles with ANSI color support, you'll see the following...

[![Color screenshot](https://camo.githubusercontent.com/36b20ecf622c34f30aa8a08c331ed7b0bc2bb838dc08b4afc0b464f311d76bae/68747470733a2f2f696d673834352e696d616765736861636b2e75732f696d673834352f313230312f356767652e706e67)](https://camo.githubusercontent.com/36b20ecf622c34f30aa8a08c331ed7b0bc2bb838dc08b4afc0b464f311d76bae/68747470733a2f2f696d673834352e696d616765736861636b2e75732f696d673834352f313230312f356767652e706e67)

In the Windows command prompt (without ANSICON), color tags will simply be stripped out.

[![Non-color screenshot](https://camo.githubusercontent.com/5380bc652a0b56af0ab3953523cab172b14e3136081909c728fe7ee321bf4ccd/68747470733a2f2f696d673833342e696d616765736861636b2e75732f696d673833342f353636372f337031742e706e67)](https://camo.githubusercontent.com/5380bc652a0b56af0ab3953523cab172b14e3136081909c728fe7ee321bf4ccd/68747470733a2f2f696d673833342e696d616765736861636b2e75732f696d673833342f353636372f337031742e706e67)

Windows users can [download ANSICON](https://github.com/adoxa/ansicon/releases) and install it by running `ansicon -i` from a command prompt or "Run" window. This will allow them to view colors.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity59

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 ~547 days

Total

2

Last Release

3829d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0acd94565d6923671be858eea16d4da1f86f3fd9d62f3603467c32fdcba46b20?d=identicon)[SimonEast](/maintainers/SimonEast)

---

Top Contributors

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

---

Tags

consolecoloransicolourcolorscoloursansicon

### Embed Badge

![Health badge](/badges/simoneast-simple-ansi-colors/health.svg)

```
[![Health](https://phpackages.com/badges/simoneast-simple-ansi-colors/health.svg)](https://phpackages.com/packages/simoneast-simple-ansi-colors)
```

###  Alternatives

[kevinlebrun/colors.php

Colors for PHP CLI scripts

3426.7M45](/packages/kevinlebrun-colorsphp)[codedungeon/php-cli-colors

Liven up you PHP Console Apps with standard colors

10210.1M26](/packages/codedungeon-php-cli-colors)[alecrabbit/php-console-spinner

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

24032.0k2](/packages/alecrabbit-php-console-spinner)[tecnickcom/tc-lib-color

PHP library to manipulate various color representations

247.2M9](/packages/tecnickcom-tc-lib-color)[alecrabbit/php-cli-snake

Lightweight cli spinner with zero dependencies

29211.3k5](/packages/alecrabbit-php-cli-snake)[inhere/console

php console library, provide console argument parse, console controller/command run, color style, user interactive, information show.

3477.4k12](/packages/inhere-console)

PHPackages © 2026

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