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

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

votemike/color
==============

CSS color object

1.0.1(9y ago)2172MITPHP

Since Feb 23Pushed 9y agoCompare

[ Source](https://github.com/votemike/color)[ Packagist](https://packagist.org/packages/votemike/color)[ RSS](/packages/votemike-color/feed)WikiDiscussions master Synced today

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

Color/Colour
------------

[](#colorcolour)

[![Build Status](https://camo.githubusercontent.com/751ed59e4dd5c95e697fe743f9e06f8fa48d40e344cc103c7d98291d5833ac6e/68747470733a2f2f7472617669732d63692e6f72672f766f74656d696b652f636f6c6f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/votemike/color)

Immutable object representing a CSS color with the abilty to format as hex, rgba and X11 strings.

Usage
-----

[](#usage)

```
// Construct with R,G,B,A values. Alpha may be ommited and will default to 1
$color = new Color(0, 100, 200);
$color = new Color(0, 100, 200, 0.5);

// Create Color object from string
$color = Color::fromRgba('0,0,0,0');
$color = Color::fromRgb('0,0,0');
$color = Color::fromHex('000000');
$color = Color::fromShortHex('F00');
$color = Color::fromX11('rebeccapurple');
$color = Color::fromHsla('180, 0%, 85%, 1');
$color = Color::fromHsl('0, 100%, 10%');

// Get strings for different formats
$color = new Color(255, 255, 255, 1);
$color->toHex(); // #ffffff
$color->toRgba(); // rgba(255,255,255,1)
$color->toX11(); // white

// If a color can't be translated, it will be an empty string
$color = new Color(0, 0, 0, 0.5);
$color->toHex(); // ''
$color->toRgba(); // rgba(255,255,255,0.5)
$color->toX11(); // ''
```

TODO
----

[](#todo)

- Create a toHsla() method

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity65

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

Total

2

Last Release

3413d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3957065?v=4)[Michael Gwynne](/maintainers/votemike)[@votemike](https://github.com/votemike)

---

Top Contributors

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

---

Tags

csscolorrgbhexcolourhslrgbahsla

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[ozdemirburak/iris

PHP library for color manipulation and conversion.

1201.8M20](/packages/ozdemirburak-iris)[ssnepenthe/color-utils

A PHP library for performing SASS-like color manipulations.

631.2M15](/packages/ssnepenthe-color-utils)[tecnickcom/tc-lib-color

PHP library to manipulate various color representations

247.7M20](/packages/tecnickcom-tc-lib-color)[spatie/color

A little library to handle color conversions

38220.5M34](/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.8M20](/packages/mexitek-phpcolors)[fjw/color-compare

A library for converting colors (Hex, RGB, HSL, CIELAB (LAB), DIN-99) and calculating color distances based on DIN-99.

1310.4k](/packages/fjw-color-compare)

PHPackages © 2026

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