PHPackages                             hurtak/phpautocolor - 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. hurtak/phpautocolor

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

hurtak/phpautocolor
===================

Simple PHP class for automated coloring with visually distinct colors

v1.2.4(11y ago)11129MITPHP

Since Oct 30Pushed 11y ago1 watchersCompare

[ Source](https://github.com/Hurtak/PHPAutoColor)[ Packagist](https://packagist.org/packages/hurtak/phpautocolor)[ Docs](https://github.com/Hurtak/PHPAutoColor)[ RSS](/packages/hurtak-phpautocolor/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHPAutoColor
============

[](#phpautocolor)

##### Simple PHP class for automated coloring with visually distinct colors.

[](#simple-php-class-for-automated-coloring-with-visually-distinct-colors)

### 1. Use case

[](#1-use-case)

- coloring people's messages in chat by their user name or their user id
- coloring list of latest users actions, on admin dashboard, by user id or username

[![](https://camo.githubusercontent.com/fd5489a526105374bc672e121b1b766c530cd810e21273797f526d88afe301d9/687474703a2f2f692e696d6775722e636f6d2f675763717732632e706e67)](https://camo.githubusercontent.com/fd5489a526105374bc672e121b1b766c530cd810e21273797f526d88afe301d9/687474703a2f2f692e696d6775722e636f6d2f675763717732632e706e67)

### 2. Features

[](#2-features)

- clever color picking of the most visually distinct colors (generated by [CIEDE2000](http://en.wikipedia.org/wiki/Color_difference#CIEDE2000) algorithm)
- maximum and minimum lightness of returned colors can be set
- fast and lightweight
- lots of customization options
- easy debugging with build in error messages

[![](https://camo.githubusercontent.com/3983b9f71d352ea99c981218af425d6ca4158c29dfb756f0f039446103320f98/687474703a2f2f692e696d6775722e636f6d2f57585172394d6c2e706e67)](https://camo.githubusercontent.com/3983b9f71d352ea99c981218af425d6ca4158c29dfb756f0f039446103320f98/687474703a2f2f692e696d6775722e636f6d2f57585172394d6c2e706e67)

### 3. Usage

[](#3-usage)

##### 2.1 Installation

[](#21-installation)

```
    git clone https://github.com/Hurtak/PHPAutoColor.git

```

Or you can use [Composer](https://getcomposer.org/)

```
    composer require hurtak/phpautocolor:@dev

```

##### 2.2 Basic setup

[](#22-basic-setup)

```
    include "PHPAutoColor/src/PHPAutoColor.php";
    $color = new PHPAutoColor();
```

##### 2.3 Settings (optional)

[](#23-settings-optional)

- customize PHPAutoColor [settings](https://github.com/Hurtak/PHPAutoColor#5-settings) or don't do anything and default settings will be used

##### 2.4 Send user id or username, color will be returned

[](#24-send-user-id-or-username-color-will-be-returned)

- integers, numbers with decimal points and strings (case sensitive) are accepted

```
    $color->getColor($userID); // returns "#000"
```

### 4. Code example

[](#4-code-example)

```

            id
            user_id
            amount
            date
