?> <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> <br> <a href="?hue=red">Red</a> | <a href="?hue=yellow">Yellow</a> | <a href="?hue=blue">Blue</a> | <a href="?hue=cyan">Cyan</a> | <a href="?hue=green">Green</a> | <a href="?hue=magenta">Magenta</a> </p> <?php $palette = new SimplePalette(); foreach ($colorNames as $color) { $palette = $palette->add(new TetradicScheme($color)); } $filtered = Palette::filterByHueRange($palette, $hueRange); $deduplicated = Palette::filterSimilarColors($filtered, 15); ?> <table width="100%"> <tr> <th>All</th> <th>Only <strong><?php echo $hueRange; ?> </strong> colors</th> <th>Without duplicates (Tolerance: 15, meaning that they have a color difference of at least 15)</th> </tr> <tr> <td valign="top" align="center"><?php echo Palette::getHtml($palette, 4); ?>
function color_palette_filter_by_hue_range(PaletteInterface $palette, $hueRange) { return Palette::filterByHueRange($palette, $hueRange); }