PHPackages                             abivia/colorspace - 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. abivia/colorspace

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

abivia/colorspace
=================

Simple library for color manipulation.

1.4.0(6mo ago)015MITPHPPHP ^8.1

Since Dec 27Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/abivia/colorspace)[ Packagist](https://packagist.org/packages/abivia/colorspace)[ RSS](/packages/abivia-colorspace/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

Abivia ColorSpace - Color conversions and manipulation
======================================================

[](#abivia-colorspace---color-conversions-and-manipulation)

This is a revisit of a library that was originally written for PHP 4, revised for PHP 5, now completely rewritten for PHP 8.1+.

It allows conversions between colors in RGB, HSL, HSB (aka HSV), and CMYK spaces. This includes parsing RGB/HSL CSS colors in both "legacy" and "modern" syntax, formatting as strings including CSS formats (hex, rgb, rgba, hsl, hsla). The library also supports a variety of color manipulation operations (blend, difference, posterize, etc.)

```
use Abivia\ColorSpace\Color;
use Abivia\ColorSpace\Hsl;
use Abivia\ColorSpace\Rgb;

// Legacy syntax. Returns an instance of Hsl.
$colorHsl = Color::fromCss('hsl(50%, 10%, 25%)');

// Modern syntax. Returns an instance of RGB
$colorRgb = Color::fromCss('rgba(50% 10% 25% / 0.5)');

// Convert RGB to HSL
$converted = new Hsl($colorRgb);

// Modern syntax
echo $converted->toCss();       // output: hsla(239 80% 50% / 0.5)

// Legacy Syntax
echo $converted->toCss(true);   // output: hsla(239,80%,50%,0.5)

// As hex (with no Alpha channel)
echo $converted->toCssHex();    // output: #7f193f
```

The library also includes the full set of predefined colors in CSS, including "transparent".

```
use Abivia\ColorSpace\Rgb;

$color = Color::fromCss('springgreen');
echo $color->toCssHex();        // output: #00ff7f

$color = Color::fromCss('transparent');
echo $color->toCss();           // output: rgba(0 0 0 / 0)
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance66

Regular maintenance activity

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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.

###  Release Activity

Cadence

Every ~62 days

Recently: every ~77 days

Total

6

Last Release

197d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/42cd72dce530e94e60853407cdab69ead232423272b482218ae686c740ce0e99?d=identicon)[abivia](/maintainers/abivia)

---

Top Contributors

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

---

Tags

colorcss3hexhslphprgb

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/abivia-colorspace/health.svg)

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

###  Alternatives

[wpbp/generator

Generator of Wordpress Plugin Boilerplate Powered

832.3k](/packages/wpbp-generator)

PHPackages © 2026

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