PHPackages                             travail/term-ansicolor - 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. travail/term-ansicolor

ActiveLibrary

travail/term-ansicolor
======================

travail/term-ansicolor

v0.1.0(12y ago)1170.6k↓100%12PHP-3.0PHP

Since May 1Pushed 11y ago1 watchersCompare

[ Source](https://github.com/travail/php-Term-ANSIColor)[ Packagist](https://packagist.org/packages/travail/term-ansicolor)[ RSS](/packages/travail-term-ansicolor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (2)

\\Term\\ANSIColor
=================

[](#termansicolor)

NAME
----

[](#name)

\\Term\\ANSIColor - Color screen output using ANSI escape sequences.

SYNOPSIS
--------

[](#synopsis)

```
use \Term\ANSIColor;

require_once '/path/to/vendor/autoload.php';

// Get a colored string
echo ANSIColor::colored("Yellow text\n", 'yellow');
echo ANSIColor::colored("Normal text on magenta\n", null, 'magenta');
echo ANSIColor::colored("Underscored text\n", null, null, 'underscore');
echo ANSIColor::colored("Red on cyan\n", 'red', 'cyan');
echo ANSIColor::colored("Blinking blue text on light gray\n", 'blue', 'light_gray', 'blink');

// Get a colored string by an alias
ANSIColor::setAlias('debug', 'red', 'light_gray');
echo ANSIColor::colored("[DEBUG] Debug message in red on light_gray\n" , 'debug');
ANSIColor::setAlias('error', 'red', 'black');
echo ANSIColor::colored("[ERROR] Error message in red on black\n" , 'error');
```

INSTALLATION
------------

[](#installation)

To install this package into your project via composer, add the following snippet to your `composer.json`. Then run `composer install`.

```
"require": {
    "travail/term-ansicolor": "dev-master"
}

```

If you want to install from github, add the following:

```
"repositories": [
    {
        "type": "vcs",
        "url": "git@github.com:travail/php-Term-ANSIColor.git"
    }
]

```

METHODS
-------

[](#methods)

### colored

[](#colored)

`string colored(string $text, string $foreground_color, string $background_color, string $attribute)`

Returns a colored text, or `Exception` if passed non-existent `$foreground_color`, `$background_color` or `$attribute`.

### setAlias

[](#setalias)

`array setAlias(string $alias, string $foreground_color, string $background_color, string $attribute)`

Sets an alias for the standard color and attribute.

### getAlias

[](#getalias)

`array getAlias([string $alais = ''])`

Returns an available alias as an array if `$alias` passed, all of alias if `$alias` not passed, or `Exception` if non-existent `$alias` passed.

### getForegourndColors

[](#getforegourndcolors)

`array getForegroundColors(void)`

Returns the defined foreground colors as array.

```
array(
    'black'       => '0;30',
    'dark_gray'   => '1;30',
    'blue'        => '0;34',
    'light_blue'  => '1;34',
    'green'       => '0;32',
    'light_green' => '1;32',
    'cyan'        => '0;36',
    'light_cyan'  => '1;36',
    'red'         => '0;31',
    'light_red'   => '1;31',
    'purple'      => '0;35',
    'light_purple'=> '1;35',
    'brown'       => '0;33',
    'yellow'      => '1;33',
    'light_gray'  => '0;37',
    'white'       => '1;37',
);

```

### getBackgroundColors

[](#getbackgroundcolors)

`array getBackgroundColors(void)`

Returns the defined background colors as array.

```
array(
    'black'      => '40',
    'red'        => '41',
    'green'      => '42',
    'yellow'     => '43',
    'blue'       => '44',
    'magenta'    => '45',
    'cyan'       => '46',
    'light_gray' => '47',
);

```

### getAttributes

[](#getattributes)

`array getAttributes(void)`

Returns the defined attributes as array.

```
array(
    'normal'     => '0',
    'bold'       => '1',
    'underscore' => '4',
    'blink'      => '5',
    'reverse'    => '7',
    'concealed'  => '8',
);

```

AUTHOR
------

[](#author)

travail

LICENSE
-------

[](#license)

This library is free software. You can redistribute it and/or modify it under the same terms as PHP itself.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.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

4391d ago

### Community

Maintainers

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

---

Top Contributors

[![travail](https://avatars.githubusercontent.com/u/52314?v=4)](https://github.com/travail "travail (30 commits)")[![tisogawa](https://avatars.githubusercontent.com/u/145603?v=4)](https://github.com/tisogawa "tisogawa (1 commits)")

### Embed Badge

![Health badge](/badges/travail-term-ansicolor/health.svg)

```
[![Health](https://phpackages.com/badges/travail-term-ansicolor/health.svg)](https://phpackages.com/packages/travail-term-ansicolor)
```

PHPackages © 2026

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