Skip to main content

Installation

Install the package with Composer:

composer require renfordt/colors

Requirements

  • PHP 8.4 or higher
  • Composer

The only runtime dependency is renfordt/clamp, which Composer resolves automatically. It provides the clamp() function used by the color classes to keep component values within their valid ranges.

Autoloading

The package uses PSR-4 autoloading under the Renfordt\Colors\ namespace, mapped to the src/ directory. Once installed, the classes are available through Composer's autoloader:

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

use Renfordt\Colors\HexColor;

$color = HexColor::create('#FF5733');