GradientBuilder
Fluent builder for creating gradients with great developer experience.
Provides a chainable API for constructing gradients with an intuitive syntax.
Methods
Set the position for radial or conic gradients.
| Name | Type | Default |
|---|---|---|
$position |
string | - |
conic
Start building a new conic gradient.
| Name | Type | Default |
|---|---|---|
$angle |
float | 0 |
Add a color stop at the start (position 0.0).
| Name | Type | Default |
|---|---|---|
$color |
ColorInterface|string | - |
Set the interpolation color space.
| Name | Type | Default |
|---|---|---|
$colorSpace |
InterpolationSpace|string | - |
linear
Start building a new linear gradient.
| Name | Type | Default |
|---|---|---|
$angle |
float | 180 |
radial
Start building a new radial gradient.
Set the shape for radial gradients.
| Name | Type | Default |
|---|---|---|
$shape |
RadialShape|string | - |
Set the size for radial gradients.
| Name | Type | Default |
|---|---|---|
$size |
RadialSize|string | - |
Add a color stop at a specific position.
| Name | Type | Default |
|---|---|---|
$color |
ColorInterface|string | - |
$position |
float | - |
Add multiple color stops with automatic position distribution.
Accepts colors, color strings, or GradientStop objects. GradientStop objects keep their
position, while colors/strings are spread evenly between the surrounding positions.
| Name | Type | Default |
|---|---|---|
$stops |
ColorInterface|GradientStop|string | - |
Add a color stop at the end (position 1.0).
| Name | Type | Default |
|---|---|---|
$color |
ColorInterface|string | - |
Add a color stop at the middle (position 0.5).
| Name | Type | Default |
|---|---|---|
$color |
ColorInterface|string | - |