/** Color\Palette functions **/ function color_palette_merge(PaletteInterface $palette, PaletteInterface $mergePalette) { return Palette::merge($palette, $mergePalette); }
<?php use Phim\Color; use Phim\Color\Palette; use Phim\Color\Palette\ShadePalette; use Phim\Color\Palette\SimplePalette; use Phim\Color\Scheme\AnalogousScheme; use Phim\Color\Scheme\TetradicScheme; use function Phim\color_get; include '../../vendor/autoload.php'; $colors = [Color::RED, Color::BLUE, Color::GREEN, Color::YELLOW]; $palette = new SimplePalette(); foreach ($colors as $color) { //Add the tetradic scheme for each color $palette = Palette::merge($palette, new TetradicScheme($color)); } //Only take blue-ish colors $palette = Palette::filterByHueRange($palette, Color::HUE_RANGE_BLUE); //Avoid similar colors $palette = Palette::filterSimilarColors($palette, 8); //Print a nice HTML representation of the palette for debugging echo Palette::getHtml($palette, 4); exit; $hueRange = isset($_GET['hue']) ? $_GET['hue'] : 'red'; $colorNames = array_values(\Phim\color_get_names()); ?> <h1>Color palette manipulation and color finding</h1> <p> Let's take all named colors, build tetradic complements for them and filter out the coolest values of a specific hue range. <br>
public function add(PaletteInterface $palette, $prepend = false) { return Palette::merge($this, $palette, $prepend); }