Example #1
0
<?php

// Initialize autoloader
require_once '../vendor/autoload.php';
// Initialize Colorizer
$colorize = new Colorizer\Colorize(64, 224);
// Examples array
$animals = array('dog', 'cat', 'horse', 'fish', 'orangutan', 'hippopotamus', 'zebra', 'alligator', 'rhinocerous', 'lion', 'tiger', 'rabbit', 'cow', 'bird', 'coyote', 'shark', 'pelican', 'weasel');
?>

<div class="swatches">

    <h3>Hex Test</h3>

    <?php 
foreach ($animals as $animal) {
    ?>

        <div class="swatch-wrapper">
            <div class="swatch" style="background-color: <?php 
    echo $colorize->toHex($animal);
    ?>
;">
                <?php 
    echo $animal;
    ?>
            </div>
        </div>

    <?php 
}
Example #2
0
 public function test_it_can_be_normalized_via_the_constructor()
 {
     $normalized = new Colorizer\Colorize(64, 224);
     $this->assertEquals('rgb(64, 64, 224)', $normalized->toRGB('Taco bueno!'));
 }