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

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

atomicptr/color
===============

A modern PHP 8.3+ color library, compatible with CSS Color Module Level 4

v0.2.1(1y ago)01.5k[1 issues](https://github.com/atomicptr/color/issues)MITPHPPHP &gt;=8.3CI passing

Since Sep 7Pushed 4mo agoCompare

[ Source](https://github.com/atomicptr/color)[ Packagist](https://packagist.org/packages/atomicptr/color)[ Fund](https://www.buymeacoffee.com/atomicptr)[ GitHub Sponsors](https://github.com/atomicptr)[ RSS](/packages/atomicptr-color/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

🎨 Color: A modern PHP 8.3+ color library
========================================

[](#-color-a-modern-php-83-color-library)

[![Software License](https://camo.githubusercontent.com/f251623e510f5909f16ae3f4e6e548dac11340b9fde1a99be26b015b39272c00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/atomicptr/color/blob/main/LICENSE)[![PHP Version](https://camo.githubusercontent.com/016f74b8436b79111206c3d16c0358ae92f2b641db5824d5d7ca139a3c500bdd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f61746f6d69637074722f636f6c6f723f7374796c653d666c6174)](https://packagist.org/packages/atomicptr/color)[![Last commit on main branch](https://camo.githubusercontent.com/8bd4bd43b37777d28ae04b75a140383f2cebf5d6a0210e399134d2674fb69f12/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f61746f6d69637074722f636f6c6f72)](https://github.com/atomicptr/color)[![Latest Version on Packagist](https://camo.githubusercontent.com/21e3a5249f9d13f42715da50358f38e8097f35c00b1da356798e9c5c0765adde/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61746f6d69637074722f636f6c6f72)](https://packagist.org/packages/atomicptr/color)[![Total Packagist downloads](https://camo.githubusercontent.com/5e2d5ea837c24f773d85bcc866ffb43cd9443e19c7bb7107515812500110a2de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61746f6d69637074722f636f6c6f72)](https://packagist.org/packages/atomicptr/color)

**Color** is a modern **PHP 8.3+ color library**, intended to be compatible with **[CSS Color Module Level 4](https://drafts.csswg.org/css-color-4)**, and inspired by **[Color.js](https://github.com/LeaVerou/color.js)** from [Lea Verou](https://github.com/LeaVerou) and [Chris Lilley](https://github.com/svgeesus).

This is a hard fork of [matthieumastadenis/couleur](https://github.com/matthieumastadenis/couleur)

The main goal of this package is to allow **color conversions** between multiple, old and new [🌈 Color Spaces](#-color-spaces), like the famous **LCH** which provides [many advantages for design purpose](https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/).

**Color** is made to be usable with an **[OOP](https://en.wikipedia.org/wiki/Object-oriented_programming)** approach as well as with a **[FP](https://en.wikipedia.org/wiki/Functional_programming)** approach:

- If you prefer **OOP**, you can use [🏭 Immutable Objects and the `ColorFactory`](#-immutable-objects-and-the-colorfactory) ;
- If you prefer **FP**, you can directly use the multiple [🧰 Pure Functions](#-pure-functions) ;

⚙️ Installation
---------------

[](#️-installation)

Use the following command to add **Color** to your project with [Composer](https://getcomposer.org/):

```
composer require atomicptr/color
```

Don't forget to include the [autoloader](https://getcomposer.org/doc/01-basic-usage.md#autoloading) provided by Composer:

```
