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

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

mikealmond/color
================

A small library to manipulate and display colors

v0.1.5(4y ago)26242.0k↓45.8%32MITPHPPHP ~7.0|~8.0CI failing

Since Jan 24Pushed 4y ago4 watchersCompare

[ Source](https://github.com/mikealmond/color)[ Packagist](https://packagist.org/packages/mikealmond/color)[ Docs](https://github.com/mikealmond/color)[ GitHub Sponsors](https://github.com/mikealmond)[ RSS](/packages/mikealmond-color/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (2)Versions (11)Used By (2)

color
=====

[](#color)

[![Build Status](https://camo.githubusercontent.com/190d17a210b1cd28064985f5fe75c849d02b89f05c8ed2d402b36b6f343acf43/68747470733a2f2f7472617669732d63692e6f72672f6d696b65616c6d6f6e642f636f6c6f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mikealmond/color)[![Code Coverage](https://camo.githubusercontent.com/a2b77994d1b2bbf0abcea462fb74468ce859bb21a8d49d4f350d66110ac83fbb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696b65616c6d6f6e642f636f6c6f722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mikealmond/color/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/3b629a1256b60f2a1b96fc793b2a13a7aa8299ea222db3a26825ac1c923bda3f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696b65616c6d6f6e642f636f6c6f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mikealmond/color/?branch=master)

This library will allow you to alter colors, check readability, and generate different palettes based on a base color.

Install
-------

[](#install)

Via Composer

```
$ composer require mikealmond/color
```

Usage
-----

[](#usage)

```
$color = Color::fromHex('FFFFFF');
echo $color->getRgb()['b']; // 255

/** @var Color $darkerColor */
$darkerColor = $color->darken(50); // 50% darker

echo $darkerColor; // implements `__toString()`

if ($darkerColor->isDark()) {
    // do something with a dark color
}
```

```
// Create a color palette based on #663399
$color     = Color::fromCssColor('RebeccaPurple');
$generator = new PaletteGenerator($color);
$palette   = $generator->triad(40);

foreach ($palette as $color) {
    printf(
    '%s',
        CssGenerator::hex($color),
        CssGenerator::hex($color->getMatchingTextColor()),
        CssGenerator::rgb($color)
    );
}
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Mike Almond](https://github.com/mikealmond)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

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

Every ~190 days

Recently: every ~261 days

Total

10

Last Release

1729d ago

PHP version history (4 changes)v0.0.1PHP ~5.6|~7.0

v0.0.3PHP ~5.5|~7.0

v0.1.0PHP ~7.0

v0.1.4PHP ~7.0|~8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/600744?v=4)[Mike Almond](/maintainers/mikealmond)[@mikealmond](https://github.com/mikealmond)

---

Top Contributors

[![mikealmond](https://avatars.githubusercontent.com/u/600744?v=4)](https://github.com/mikealmond "mikealmond (44 commits)")[![CraftLogan](https://avatars.githubusercontent.com/u/10950466?v=4)](https://github.com/CraftLogan "CraftLogan (1 commits)")

---

Tags

colorcolor-manipulationcolor-palettes-generatorpalettephpwcag2colormikealmond

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[spatie/color

A little library to handle color conversions

38221.2M36](/packages/spatie-color)[mexitek/phpcolors

A series of methods that let you manipulate colors. Just incase you ever need different shades of one color on the fly.

4993.9M20](/packages/mexitek-phpcolors)[mistic100/randomcolor

Generate attractive random colors

2451.5M6](/packages/mistic100-randomcolor)[ozdemirburak/iris

PHP library for color manipulation and conversion.

1201.9M23](/packages/ozdemirburak-iris)[kartik-v/yii2-widget-colorinput

An enhanced Yii 2 widget encapsulating the HTML 5 color input (sub repo split from yii2-widgets)

345.1M11](/packages/kartik-v-yii2-widget-colorinput)[tecnickcom/tc-lib-color

PHP library to manipulate various color representations

247.9M25](/packages/tecnickcom-tc-lib-color)

PHPackages © 2026

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