PHPackages                             decodelabs/spectrum - 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. decodelabs/spectrum

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

decodelabs/spectrum
===================

Bring colour to PHP

v0.3.8(7mo ago)31.4kMITPHPPHP ^8.4CI passing

Since Apr 12Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/decodelabs/spectrum)[ Packagist](https://packagist.org/packages/decodelabs/spectrum)[ RSS](/packages/decodelabs-spectrum/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (18)Used By (0)

Spectrum
========

[](#spectrum)

[![PHP from Packagist](https://camo.githubusercontent.com/0d2674ae41f99fe20b942e572816468ef178aa84665124c8d932faac5e8c5d14/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6465636f64656c6162732f737065637472756d3f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/spectrum)[![Latest Version](https://camo.githubusercontent.com/3d4e76f3e7ffedb841eef24505eacc7d4afc7113a2572f8796d7f96d15037f70/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465636f64656c6162732f737065637472756d2e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/spectrum)[![Total Downloads](https://camo.githubusercontent.com/2d31cd8276eb7819ab5af00a9abf3b48ca06afcb5656e61847bf117f452ae6f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465636f64656c6162732f737065637472756d2e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/spectrum)[![GitHub Workflow Status](https://camo.githubusercontent.com/ca97ff105182f721005a2724eb9b25486905de7e569594a5627ea0d74a9bd8df/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6465636f64656c6162732f737065637472756d2f696e746567726174652e796d6c3f6272616e63683d646576656c6f70)](https://github.com/decodelabs/spectrum/actions/workflows/integrate.yml)[![PHPStan](https://camo.githubusercontent.com/e25c14ce011edabdd0fbd2e10415b41cc5d66ed11ef3e5b7edd074c5bdd35a2d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d3434434331312e7376673f6c6f6e6743616368653d74727565267374796c653d666c6174)](https://github.com/phpstan/phpstan)[![License](https://camo.githubusercontent.com/45832e10281e5261e0837479dcb96c39991e53c9f92e5c61af0ace39d9feaee0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6465636f64656c6162732f737065637472756d3f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/spectrum)

### Parse and manipulate colors

[](#parse-and-manipulate-colors)

Spectrum offers a simple but powerful system for parsing, inspecting, manipulating and exporting colors.

---

Installation
------------

[](#installation)

This package requires PHP 8.4 or higher.

Install via Composer:

```
composer require decodelabs/spectrum
```

Usage
-----

[](#usage)

Load and manipulate any color with ease through RGB, HSL and HSV formats.

```
use DecodeLabs\Spectrum\Color;

$color = Color::create('#5AB3CD');
$color = Color::create('darkblue');
$color = Color::create('rgba(25,25,25,0.4)');
$color = Color::random();

$color->toHsl();
$color->lighten(0.3); // 30% lighter
$color->setAlpha(0.5); // 50% opacity
$color->toMidtone(); // Medium saturation and lightness

echo $color; // Converts to appropriate CSS value

$contrastColor = $color->contrastAgainst('pink');
$textColor = $color->getTextContrastColor();
```

Licensing
---------

[](#licensing)

Spectrum is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance68

Regular maintenance activity

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity68

Established project with proven stability

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

Recently: every ~19 days

Total

16

Last Release

224d ago

PHP version history (4 changes)v0.1.0PHP ^7.2|^8.0

v0.2.0PHP ^8.0

v0.2.3PHP ^8.1

v0.3.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a241d64d12b3b5ee94197862ec1ec30b82ed2efa34a0cd7f4c3565a021daddd?d=identicon)[betterthanclay](/maintainers/betterthanclay)

---

Top Contributors

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

---

Tags

colorphpcolorcolour

### Embed Badge

![Health badge](/badges/decodelabs-spectrum/health.svg)

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

###  Alternatives

[spatie/color

A little library to handle color conversions

38018.9M28](/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.

5003.6M18](/packages/mexitek-phpcolors)[tecnickcom/tc-lib-color

PHP library to manipulate various color representations

247.2M9](/packages/tecnickcom-tc-lib-color)[mistic100/randomcolor

Generate attractive random colors

2431.4M6](/packages/mistic100-randomcolor)[kartik-v/yii2-widget-colorinput

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

324.8M10](/packages/kartik-v-yii2-widget-colorinput)[tractorcow/silverstripe-colorpicker

Color picker field for Silverstripe CMS using the ColorPicker jQuery plugin

18250.8k13](/packages/tractorcow-silverstripe-colorpicker)

PHPackages © 2026

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