Пример #1
0
$hex = rgb2hex($r, $g, $b);
$hsl = rgb2hsl($r, $g, $b);
$h = $hsl[0];
$s = $hsl[1];
$l = $hsl[2];
$color = readable_color($r, $g, $b);
?>

	<div class="color-results" style="<?php 
echo 'background-color:' . $hex . '; color:' . $color . ';';
?>
">


<?php 
rgb_sample($r, $g, $b, 'Basic color');
?>
		<h3>Complementary colors:</h3>
					
<?php 
hsl_sample($h + 30, $s, $l, 'Analogous harmony (H+30)');
hsl_sample($h - 30, $s, $l, 'Analogous harmony (H-30)');
hsl_sample($h + 120, $s, $l, 'Triadic harmony (H+120)');
hsl_sample($h - 120, $s, $l, 'Triadic harmony (H-120)');
hsl_sample($h + 150, $s, $l, 'Split complements harmony (H+150)');
hsl_sample($h - 150, $s, $l, 'Split complements harmony (H-150)');
hsl_sample($h + 180, $s, $l, 'Complement harmony (H+180)');
hsl_sample($h, $s + 30, $l, 'Monochromatic harmony (S+30)');
hsl_sample($h, $s - 30, $l, 'Monochromatic harmony (S-30)');
hsl_sample($h, $s, $l + 10, 'Monochromatic harmony (L+10)');
hsl_sample($h, $s, $l - 10, 'Monochromatic harmony (L-10)');
Пример #2
0
		</table>
	</div><!-- .form-container -->
<?php 
if (isset($_GET['mode1']) && isset($_GET['mode2']) || $_GET['color'] == 'Gradient') {
    ?>
		<h3>Color gradient</h3>
		<div class="color-results">
			<div class="variations">
<?php 
    $del_h = ($h2 - $h1) / ($steps + 1);
    $del_s = ($s2 - $s1) / ($steps + 1);
    $del_l = ($l2 - $l1) / ($steps + 1);
    rgb_sample($r1, $g1, $b1, 'First color');
    for ($i = 1; $i <= $steps; $i++) {
        hsl_sample($h1 + round($del_h * $i), $s1 + round($del_s * $i), $l1 + round($del_l * $i), 'Gradient');
        echo chr(10);
    }
    rgb_sample($r2, $g2, $b2, 'Second color');
    ?>
			</div>
		</div>
		
<?php 
}
?>


<?php 
include '../inc/_wrap_after.php';
include '../inc/_sidebar.php';
include '../inc/_footer.php';
Пример #3
0
    }
    if ($l > 100) {
        $l = 100;
    }
    $rgb = hsl2rgb($h, $s, $l);
    $r = $rgb[0];
    $g = $rgb[1];
    $b = $rgb[2];
    $hex = rgb2hex($r, $g, $b);
    //$hex = substr($hex,1); // remove '#'
    rgb_sample($r, $g, $b, 'Basic color');
}
if (isset($_GET['h2'])) {
    $h2 = $_GET['h2'];
    $rgb2 = hsl2rgb($h2, $s, $l);
    rgb_sample($rgb2[0], $rgb2[1], $rgb2[2], 'New color');
    $hex2 = rgb2hex($rgb2[0], $rgb2[1], $rgb2[2]);
} else {
    $h2 = 1000;
    /* hue radio will not be checked */
}
?>

<script type="text/javascript">
jQuery(function($){
	$('.form-container').wrap('<fo'+'rm name="color" method="get" action="<?php 
echo basename(__FILE__);
?>
"></fo'+'rm>');
});
</script>