Exemplo n.º 1
0
    $color = color_get($hex);
    echo \Phim\color_get_html($color);
    $mc = new \Phim\Color\Scheme\HueRotationScheme($color, 20, 5);
    foreach ($mc as $compareColor) {
        echo '<div style="display: inline-block; vertical-align: top; text-align: center;">';
        echo \Phim\color_get_html($compareColor);
        echo '<br>';
        echo '<span style="padding: 10px;">' . \Phim\Color::getDifference($color, $compareColor) . '</span>';
        echo '</div>';
    }
    echo '<br>';
}
echo '</div>';
echo '<h1>Finding visually similar colors (Tolerance: ' . $t . ', control with &lt;url&gt;?t=&lt;tolerance&gt;)</h1>';
echo '<div style="white-space: nowrap;">';
foreach ($names as $name => $hex) {
    $color = color_get($hex);
    echo \Phim\color_get_html($color);
    foreach (\Phim\color_get_names() as $compareColor) {
        $deltaE = \Phim\Color::getDifference($color, color_get($compareColor));
        if ($deltaE < $t) {
            echo '<div style="display: inline-block; vertical-align: top; text-align: center;">';
            echo Phim\Color::getHtml(color_get($compareColor));
            echo '<br>';
            echo '<span style="padding: 10px;">' . $deltaE . '</span>';
            echo '</div>';
        }
    }
    echo '<br>';
}
echo '</div>';
Exemplo n.º 2
0
function color_get_difference($color, $compareColor)
{
    return Color::getDifference(color_get($color), color_get($compareColor));
}