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

ActiveLibrary

cjrasmussen/color
=================

Simple functions for color conversion and analysis

2.0.1(1y ago)01752MITPHPPHP &gt;=7.4.0

Since Sep 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/cjrasmussen/Color)[ Packagist](https://packagist.org/packages/cjrasmussen/color)[ Docs](https://cjr.dev)[ RSS](/packages/cjrasmussen-color/feed)WikiDiscussions main Synced 4d ago

READMEChangelogDependencies (2)Versions (11)Used By (2)

Color
=====

[](#color)

Simple functions for color conversion and analysis.

Usage
-----

[](#usage)

```
use cjrasmussen\Color\ColorType\Hex;
use cjrasmussen\Color\ColorType\Rgb;
use cjrasmussen\Color\General;

$rgb = new Rgb(153, 51, 51);
$hex = $rgb->toHex();
echo $hex; // 993333

$is_hex = General::isHexColor('993333');
echo $is_hex; // true

$hex = new Hex('993333');
$rgb = $hex->toRgb();
```

There are no methods for directly converting Hex/HSL/HSV to Hex/HSL/HSV (or for getting luminence of Hex/HSL/HSV) but RGB can be used as a stepping-stone.

```
$hsl = (new Hex('#800'))->toRgb()->toHsl();
```

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

[](#installation)

Simply add a dependency on cjrasmussen/color to your composer.json file if you use [Composer](https://getcomposer.org/) to manage the dependencies of your project:

```
composer require cjrasmussen/color
```

Although it's recommended to use Composer, you can actually include the file(s) any way you want.

License
-------

[](#license)

Color is [MIT](http://opensource.org/licenses/MIT) licensed.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

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

Recently: every ~31 days

Total

10

Last Release

679d ago

Major Versions

1.3.3 → 2.0.02024-06-30

PHP version history (2 changes)v1.0PHP &gt;=7.1.0

1.3.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0225f44837a665c8a143afa50a34a406a769c523dba31e4cdf73fd0530dede45?d=identicon)[cjrasmussen](/maintainers/cjrasmussen)

---

Top Contributors

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

---

Tags

colorrgbhsl

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/color

A little library to handle color conversions

38018.9M28](/packages/spatie-color)[ozdemirburak/iris

PHP library for color manipulation and conversion.

1201.7M16](/packages/ozdemirburak-iris)[ssnepenthe/color-utils

A PHP library for performing SASS-like color manipulations.

631.1M10](/packages/ssnepenthe-color-utils)[tecnickcom/tc-lib-color

PHP library to manipulate various color representations

247.2M9](/packages/tecnickcom-tc-lib-color)[fjw/color-compare

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

1310.0k](/packages/fjw-color-compare)[gabrieldarezzo/colorizzar

Change the colors of an image without lose alpha channnel

273.7k](/packages/gabrieldarezzo-colorizzar)

PHPackages © 2026

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