tecnickcom/tc-lib-color

PHP library to manipulate various color representations

Maintainers

Package info

github.com/tecnickcom/tc-lib-color

Homepage

pkg:composer/tecnickcom/tc-lib-color

Statistics

Installs: 7 370 034

Dependents: 8

Suggesters: 0

Stars: 24

Open Issues: 0


README

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

Latest Stable Version Build Coverage License Downloads

Donate via PayPal

If this library helps your graphics workflow, please consider supporting development via PayPal.

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 info@tecnick.com
License GNU LGPL v3 - see LICENSE
API docs https://tcpdf.org/docs/srcdoc/tc-lib-color
Packagist https://packagist.org/packages/tecnickcom/tc-lib-color

Features

Color Models

  • RGB/RGBA and hexadecimal color handling
  • HSL/HSLA and CMYK conversion workflows
  • Grayscale and spot color support

Integration Helpers

  • CSS-ready color output
  • PDF-oriented color conversion helpers
  • Named web color lookup and normalization

Requirements

  • PHP 8.1 or later
  • Extension: pcre
  • Composer

Installation

composer require tecnickcom/tc-lib-color

Quick Start

<?php

require_once __DIR__ . '/vendor/autoload.php';

$web = new \Com\Tecnick\Color\Web();
$rgb = $web->getRgbObjFromHex('#336699');

echo $rgb->getCssColor();

See example/index.php for a complete conversion showcase.

Development

make deps
make help
make qa

Packaging

make rpm
make deb

For system packages, bootstrap with:

require_once '/usr/share/php/Com/Tecnick/Color/autoload.php';

Contributing

Contributions are welcome. Please review CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.

Contact

Nicola Asuni - info@tecnick.com