PHPackages                             hugsbrugs/php-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. hugsbrugs/php-color

ActiveLibrary

hugsbrugs/php-color
===================

PHP Color Utilities

04PHP

Since Mar 17Pushed 9y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

php-color
=========

[](#php-color)

This library provides utilities function to ease color manipulation

[![Build Status](https://camo.githubusercontent.com/a403bcf209d03584746870cabb5eafc042ce3dddfc3ee729f416840ec7aafc00/68747470733a2f2f7472617669732d63692e6f72672f6875677362727567732f7068702d636f6c6f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hugsbrugs/php-color)[![Coverage Status](https://camo.githubusercontent.com/3f45846af1eb6e27c433ad3526f698cb649a1f12ee008af6ff6c3197868b6c94/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6875677362727567732f7068702d636f6c6f722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/hugsbrugs/php-color?branch=master)

Install
-------

[](#install)

Install package with composer

```
composer require hugsbrugs/php-color

```

In your PHP code, load library

```
require_once __DIR__ . '/../vendor/autoload.php';
use Hug\Color\Color as Color;
```

Test a color is hexadecimal

```
Color:: is_hexa_color($color, $with_hash = true);
```

Examples

```
var_dump(Color::is_hexa_color('#fff'));
(bool)true
var_dump(Color::is_hexa_color('#fff555'));
(bool)true
var_dump(Color::is_hexa_color('frfrfr', false));
(bool)false
```

Convert hexadecimal color to RGB

```
Color:: hexa_to_rgb($hex, $return = 'array');
```

Examples

```
var_dump(Color::hexa_to_rgb('#fff'));
array(3) {
  'R' => int(255)
  'G' => int(255)
  'B' => int(255)
}

var_dump(Color::hexa_to_rgb('#fff555'));
array(3) {
  'R' => int(255)
  'G' => int(245)
  'B' => int(85)
}

var_dump(Color::hexa_to_rgb('frfrfr', 'string'));
(bool)false
```

Unit Tests
----------

[](#unit-tests)

```
composer exec phpunit

```

Author
------

[](#author)

Hugo Maugey [visit my website ;)](https://hugo.maugey.fr)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

colorphp

### Embed Badge

![Health badge](/badges/hugsbrugs-php-color/health.svg)

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

PHPackages © 2026

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