Cotton Candy

A linear gradient sweeping from light magenta to pastel blue, interpolated in OKLCH across 3 stops so the midpoint stays vivid instead of greying out.

Type
Linear
Stops
3
Space
OKLCH
Direction
45deg

The stops behind Cotton Candy

Endpoints sit closest to plum and skyblue.

0% · #ffb0e4 L 0.88 · C 0.14 · H 350
50% · #deb4ff L 0.85 · C 0.16 · H 300
100% · #8ddeff L 0.88 · C 0.14 · H 250

Create Cotton Candy in PHP

Build a linear gradient from the catalog stops, then let PHPColor assign their positions.

<?php

use PhpColor\Color\Gradient\Gradient;

$gradient = Gradient::linear(
    45,
    'oklch(0.88 0.14 350)',
    'oklch(0.85 0.16 300)',
    'oklch(0.88 0.14 250)',
);
use PhpColor\Color\Gradient\Gradient; $gradient = Gradient::linear( 45, 'oklch(0.88 0.14 350)', 'oklch(0.85 0.16 300)', 'oklch(0.88 0.14 250)', );

Inspect and convert its stops

Each stop remains a color object, ready for conversion, contrast checks, or further manipulation.

<?php

foreach ($gradient->getStops() as $stop) {
    echo $stop->color->to('oklch')->toCss();
}
foreach ($gradient->getStops() as $stop) { echo $stop->color->to('oklch')->toCss(); }

Format Cotton Candy for CSS

Serialize the gradient directly, or choose a wide-gamut notation for every stop.

<?php

$css = $gradient->toCss();
$p3  = $gradient->toCss('display-p3');
$css = $gradient->toCss(); $p3 = $gradient->toCss('display-p3');
background: linear-gradient(45deg, oklch(0.88 0.14 350), oklch(0.85 0.16 300), oklch(0.88 0.14 250));
background: linear-gradient(45deg, oklch(0.88 0.14 350), oklch(0.85 0.16 300), oklch(0.88 0.14 250));

Keep exploring

Build on Cotton Candy