ColorPaletteBuilder

Fluent builder for creating and manipulating color palettes.

Methods

add

public function add(ColorInterface|string $color, string|int|null $name): ColorPaletteBuilder

Add a color to the palette.

Parameters
NameTypeDefault
$color ColorInterface|string -
$name string|int|null null
public function addAll(iterable $colors): ColorPaletteBuilder

Add multiple colors to the palette.

Parameters
NameTypeDefault
$colors iterable -
public function build(): ColorPalette

Build the color palette.

fix

public function fix(PaletteFixerInterface $fixer, array $options): ColorPaletteBuilder

Apply a fixer to the current colors in the builder.

Parameters
NameTypeDefault
$fixer PaletteFixerInterface -
$options array []
public function harmony(ColorInterface|string $base, HarmonyPattern|string $pattern): ColorPaletteBuilder

Add a harmony palette generated from a base color.

Parameters
NameTypeDefault
$base ColorInterface|string -
$pattern HarmonyPattern|string -
public function shades(ColorInterface|string $color, int $steps): ColorPaletteBuilder

Add a scale of shades generated from a base color.

Parameters
NameTypeDefault
$color ColorInterface|string -
$steps int 5
public function tints(ColorInterface|string $color, int $steps): ColorPaletteBuilder

Add a scale of tints generated from a base color.

Parameters
NameTypeDefault
$color ColorInterface|string -
$steps int 5
public function transform(ColorPaletteTransformerInterface|callable $transformer): ColorPaletteBuilder

Apply a transformer to the current colors in the builder.

Parameters
NameTypeDefault
$transformer ColorPaletteTransformerInterface|callable -