PHPackages                             tecnickcom/tc-lib-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. tecnickcom/tc-lib-color

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

tecnickcom/tc-lib-color
=======================

PHP library to manipulate various color representations

2.12.2(1w ago)247.9M↓31.6%67LGPL-3.0-or-laterPHPPHP &gt;=8.2CI passing

Since Feb 24Pushed 1w ago1 watchersCompare

[ Source](https://github.com/tecnickcom/tc-lib-color)[ Packagist](https://packagist.org/packages/tecnickcom/tc-lib-color)[ Docs](https://tcpdf.org)[ GitHub Sponsors](https://github.com/sponsors/tecnickcom)[ RSS](/packages/tecnickcom-tc-lib-color/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (10)Versions (153)Used By (7)

tc-lib-color
============

[](#tc-lib-color)

> PHP color toolkit for conversion and normalization across common color models.

[![Latest Stable Version](https://camo.githubusercontent.com/599a65c84ba4ba774d3d23e6d1b970b5c551f931d0c836bb2ca9ccc78926e36c/68747470733a2f2f706f7365722e707567782e6f72672f7465636e69636b636f6d2f74632d6c69622d636f6c6f722f76657273696f6e)](https://packagist.org/packages/tecnickcom/tc-lib-color)[![Build](https://github.com/tecnickcom/tc-lib-color/actions/workflows/check.yml/badge.svg)](https://github.com/tecnickcom/tc-lib-color/actions/workflows/check.yml)[![Coverage](https://camo.githubusercontent.com/6cadaad2ce65b79278d2f95d0cf180f99abc01143ba370888c5c710a5decf044/68747470733a2f2f636f6465636f762e696f2f67682f7465636e69636b636f6d2f74632d6c69622d636f6c6f722f67726170682f62616467652e7376673f746f6b656e3d6c335543566253686d63)](https://codecov.io/gh/tecnickcom/tc-lib-color)[![License](https://camo.githubusercontent.com/cfea0eeec2cb0c4484d19b39deed80fb2d3451443877ce067f4e1ccab74cb6c5/68747470733a2f2f706f7365722e707567782e6f72672f7465636e69636b636f6d2f74632d6c69622d636f6c6f722f6c6963656e7365)](https://packagist.org/packages/tecnickcom/tc-lib-color)[![Downloads](https://camo.githubusercontent.com/9aea5726dff06f96e45f3f8a70b767a2810c1c90ae894e17d395b91cfbdcfdd4/68747470733a2f2f706f7365722e707567782e6f72672f7465636e69636b636f6d2f74632d6c69622d636f6c6f722f646f776e6c6f616473)](https://packagist.org/packages/tecnickcom/tc-lib-color)

[![Sponsor on GitHub](https://camo.githubusercontent.com/dd89cb32d6e7ff9dbb0fa7ce84923567358b220feb9198b3720beabc3153da6a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73706f6e736f722d6769746875622d4541344141412e7376673f6c6f676f3d67697468756273706f6e736f7273266c6f676f436f6c6f723d7768697465)](https://github.com/sponsors/tecnickcom)

> 💖 Part of the [tc-lib-pdf / TCPDF](https://github.com/tecnickcom/tc-lib-pdf) ecosystem (100M+ installs). [Sponsor its maintenance →](https://github.com/sponsors/tecnickcom)

---

Overview
--------

[](#overview)

`tc-lib-color` provides utilities for parsing, converting, and formatting color values used in web and PDF rendering pipelines.

The library is designed to centralize color logic so applications avoid ad-hoc conversion code and rounding drift across modules. It provides a consistent normalization layer that helps keep visual output aligned between browser previews and final PDF rendering.

**Namespace**`\Com\Tecnick\Color`**Author**Nicola Asuni **License**[GNU LGPL v3](https://www.gnu.org/copyleft/lesser.html) - see [LICENSE](LICENSE)**API docs****Packagist**---

Features
--------

[](#features)

### Color Models

[](#color-models)

- Grayscale (GRAY)
- RGB/RGBA and hexadecimal color handling (RGB)
- HSL/HSLA conversion workflows (HSL)
- CMYK conversion workflows (CMYK)
- CIE Lab color handling and conversion workflows (LAB)
- Spot colors (Separation), with DeviceCMYK and Lab alternate color-space support for PDF output

### Integration Helpers

[](#integration-helpers)

- CSS-ready color output
- PDF-oriented color conversion helpers
- Cross-model conversion helpers on all color models
- Named web color lookup and normalization

---

Requirements
------------

[](#requirements)

- PHP 8.2 or later
- Extension: `pcre`
- Composer

---

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

[](#installation)

```
composer require tecnickcom/tc-lib-color
```

---

Quick Start
-----------

[](#quick-start)

```
