GradientInterface

Interface

Interface for all gradient types.

Defines the contract for gradients, which represent smooth transitions
between multiple color stops along a path (linear, radial, or conic).

Methods

public function addStop(ColorInterface $color, float $position): static

Add a color stop to the gradient.

Parameters
NameTypeDefault
$color ColorInterface -
$position float -
public function getStops(): array

Get all color stops in this gradient.

public function getType(): string

Get the gradient type name.

public function interpolate(float $position): ColorInterface

Interpolate the color at a specific position in the gradient.

Parameters
NameTypeDefault
$position float -
public function toCss(string $colorSpace): string

Generate CSS gradient notation.

Parameters
NameTypeDefault
$colorSpace string null