PHPackages                             innmind/colour - 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. innmind/colour

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

innmind/colour
==============

Handle colours strictly

5.1.0(3w ago)163.2k↓48%14MITPHPPHP ~8.4CI passing

Since Sep 9Pushed 3w ago1 watchersCompare

[ Source](https://github.com/Innmind/Colour)[ Packagist](https://packagist.org/packages/innmind/colour)[ Docs](http://github.com/Innmind/Colour)[ RSS](/packages/innmind-colour/feed)WikiDiscussions develop Synced 1w ago

READMEChangelog (4)Dependencies (8)Versions (17)Used By (4)

Colour
======

[](#colour)

[![CI](https://github.com/Innmind/Colour/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Innmind/Colour/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/db8b5502d9b6d9cf2aa04bf5ee72ff6fb611df987828994dc900415778f4144e/68747470733a2f2f636f6465636f762e696f2f67682f696e6e6d696e642f636f6c6f75722f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/innmind/colour)[![Type Coverage](https://camo.githubusercontent.com/5039770b23eff6167bfaf0311a801527a749349fe7b62bec7fc973286eea9c86/68747470733a2f2f73686570686572642e6465762f6769746875622f696e6e6d696e642f636f6c6f75722f636f7665726167652e737667)](https://shepherd.dev/github/innmind/colour)

This library helps you build an object representation of a colour out of a string (all objects are immutable). You can easily extract any information out of the colors, transform their representation and modify the colours.

It supports these formats:

- `#39f`
- `#39ff` (last hexadecimal value for the alpha)
- `#3399ff`
- `#3399ffff` (last 2 hexadecimal values for the alpha)
- `rgb()`
- `rgba()`
- `hsl()`
- `hsla()`
- `device-cmyk()`
- literals (as [defined](https://www.w3.org/wiki/CSS/Properties/color/keywords) by the W3C)

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

[](#installation)

```
composer install innmind/colour
```

Usage
-----

[](#usage)

```
use Innmind\Colour\Colour;

$rgba = Colour::of('39f');
$hsla = Colour::of('hsl(210, 100%, 60%)');
$cmyka = Colour::of('device-cmyk(80%, 40%, 0%, 0%)');
$rgba = Colour::blue->toRGBA();
```

Each representation can be represented to the other two so you can always work with your preferred format.

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance94

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

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

Recently: every ~260 days

Total

14

Last Release

26d ago

Major Versions

1.0.0 → 2.0.02017-02-12

2.2.0 → 3.0.02019-12-13

3.2.0 → 4.0.02022-02-20

4.3.0 → 5.0.02026-01-25

PHP version history (7 changes)1.0.0PHP ~7.0

2.1.0PHP ~7.1

3.0.0PHP ~7.4

3.2.0PHP ~7.4|~8.0

4.0.0PHP ~8.1

4.1.0PHP ~8.2

5.0.0PHP ~8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (135 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (3 commits)")

---

Tags

colour

### Embed Badge

![Health badge](/badges/innmind-colour/health.svg)

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

###  Alternatives

[tecnickcom/tc-lib-color

PHP library to manipulate various color representations

247.7M20](/packages/tecnickcom-tc-lib-color)[tractorcow/silverstripe-colorpicker

Color picker field for Silverstripe CMS using the ColorPicker jQuery plugin

18260.4k14](/packages/tractorcow-silverstripe-colorpicker)[villfa/invert-color

InvertColor - invert hex color code

15119.2k2](/packages/villfa-invert-color)[presseddigital/colorit

A slick color picker fieldtype plugin for the Craft CMS 3 control panel.

2032.4k](/packages/presseddigital-colorit)

PHPackages © 2026

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