Whatever created it, a color is an object in one color space, implementing ColorInterface. Every class exposes the same properties and the same operations. That shared surface is what lets any color flow into gradients, palettes, and contrast checks later in the tour.
Properties and adjusters
Ask a color what it is. The getters answer in perceptual terms, whatever space the object lives in:
use PhpColor\Color\Color;
$blue = Color::parse('#3b82f6');
$blue->getHue(); // 259.8
$blue->getLuminance(); // 0.235
$blue->isLight(); // true
$blue->isCold(); // true
use PhpColor\Color\Color;
$blue = Color::parse('#3b82f6');
$blue->getHue(); // 259.8
$blue->getLuminance(); // 0.235
$blue->isLight(); // true
$blue->isCold(); // true
The with*() adjusters set one value and return a new object:
$lighter = $blue->to('oklch')->withChannel('l', 0.75);
// #62abff
$veiled = $blue->withAlpha(0.5);
// rgb(59 130 246 / 0.5)
$lighter = $blue->to('oklch')->withChannel('l', 0.75);
// #62abff
$veiled = $blue->withAlpha(0.5);
// rgb(59 130 246 / 0.5)
Operations
The verbs of the library. Each returns a new color; the receiver never changes:
$blue->tint(0.3); // toward white
$blue->shade(0.3); // toward black
$blue->warm(0.2); // toward warm hues
$blue->rotateHue(120); // around the wheel
$blue->grayscale(); // perceptual gray
$blue->tint(0.3); // toward white
$blue->shade(0.3); // toward black
$blue->warm(0.2); // toward warm hues
$blue->rotateHue(120); // around the wheel
$blue->grayscale(); // perceptual gray
Chain them freely: immutability means no step can corrupt another, and every result keeps the concrete class of its receiver.
Conversion
to() moves a color between spaces, and it is the quiet engine behind everything above: reading a hue from an RGB object, tinting perceptually, warming a color -- all of it converts through OKLCH internally, then hands you back what you started with.
$blue->to('oklch')->toCss();
// oklch(0.623083 0.188015 259.815)
$blue->to('display-p3')->toCss();
// color(display-p3 0.310018 0.503944 0.936356)
$blue->to('oklch')->toCss();
// oklch(0.623083 0.188015 259.815)
$blue->to('display-p3')->toCss();
// color(display-p3 0.310018 0.503944 0.936356)
Formatting closes the loop: toCss() emits the current space's syntax, toHex(true) an eight-digit fallback for anything older.
Go deeper: Manipulating and mixing colors walks every operation, and Color spaces, conversion, and output covers to() and the formatters.