<div style="clear:both; float:none;"> <input type="submit" class="submit" name="color" value="Click" /> </div> </div><!-- .form-container --> <!-- Complementary colors --> <h3>Results</h3> <?php $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)');
echo '</tr>' . chr(10); } } ?> </table> <h3>Table of "grey" web safe colors</h3> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="websafetable"> <?php echo '<tr>' . chr(10); for ($i = 0; $i <= 255; $i += 51) { echo ' <td>'; //rgb_sample($i,$i,$i,''); $hsl = rgb2hsl($i, $i, $i); $hex = rgb2hex($i, $i, $i); $color = readable_color($i, $i, $i); echo chr(10) . '<div class="rgb-sample" style="background:' . $hex . '; color:' . $color . ';">' . chr(10); echo ' ' . $hex . '; rgb(' . $i . ',' . $i . ',' . $i . '); hsl(' . $hsl[0] . ',' . $hsl[1] . '%,' . $hsl[2] . '%); ' . chr(10); echo ' </td>' . chr(10); } echo '</tr>' . chr(10); ?> </table> <?php include '../inc/_wrap_after.php'; include '../inc/_sidebar.php'; include '../inc/_footer.php';
change: function(event, ui) { // event = standard jQuery event, produced by whichever control was changed. // ui = standard jQuery UI object, with a color member containing a Color.js object $('.color-action').css('background-color', ui.color.toString()); } }); }); </script> <?php // randomize $rand_r = rand(0, 255); $rand_g = rand(0, 255); $rand_b = rand(0, 255); $rand = rgb2hex($rand_r, $rand_g, $rand_b); $bgrand = readable_color($rand_r, $rand_g, $rand_b); ?> <h2>New color with changing Hue</h2> <p>Here You can set your color in RGB or HSL mode and find new color with changing <strong>Hue</strong>, but <strong>Saturation</strong> and <strong>Lightness</strong> will be the same or just click <?php echo random_link_hex(); ?> .</p> <?php $modehex = $modergb = $modehsl = ''; if (!isset($_GET['mode']) && $_GET['hex'] || $_GET['mode'] == 'hex' && !$_GET['hex'] == '') { $modehex = ' checked="checked" '; $modergb = $modehsl = ''; $hex = strtolower($_GET['hex']); if (substr($hex, 0, 1) != '#') { $hex = '#' . $hex;
<?php include '../include.php'; include '../inc/_header.php'; include '../inc/_wrap_before.php'; ?> <?php // randomize $rand_h = rand(0, 359); $rand_s = rand(0, 40) + 50; $rand_l = rand(0, 20) + 40; $rand_rgb = hsl2rgb($rand_h, $rand_s, $rand_l); $rand = rgb2hex($rand_rgb[0], $rand_rgb[1], $rand_rgb[2]); $bgrand = readable_color($rand_rgb[0], $rand_rgb[1], $rand_rgb[2]); ?> <h2>Convert HSL to RGB</h2> <p>You can convert color from HSL to RGB and from HSL to Hex or just click <?php echo random_link_hsl(); ?> .</p> <?php if (isset($_GET['h']) && isset($_GET['s']) && isset($_GET['l'])) { $h = $_GET['h']; $s = $_GET['s']; $l = $_GET['l']; hsl_sample($h, $s, $l, 'Basic color'); }
} ?> </div> </div> <div style="clear:both; float:none;"> <input type="submit" class="submit" name="color" value="Click" /> </div> </div><!-- .form-container --> <!-- Complementary colors --> <?php $rgb = hsl2rgb($h, $s, $l); $hex = rgb2hex($rgb[0], $rgb[1], $rgb[2]); $color = readable_color($rgb[0], $rgb[1], $rgb[2]); ?> <h3>Results</h3> <div class="color-results" style="<?php echo 'background-color:' . $hex . '; color:' . $color . ';'; ?> "> <?php hsl_sample($h, $s, $l, 'Basic color'); ?> <h3>Complementary colors:</h3> <?php hsl_sample($h + 30, $s, $l, 'Analogous harmony (H+30)');
function random_link_hsl() { $rand_h = rand(0, 359); $rand_s = rand(0, 100); $rand_l = rand(0, 100); $rand_rgb = hsl2rgb($rand_h, $rand_s, $rand_l); $rand = rgb2hex($rand_rgb[0], $rand_rgb[1], $rand_rgb[2]); $bgrand = readable_color($rand_rgb[0], $rand_rgb[1], $rand_rgb[2]); return '<!--googleoff: index--><a rel="nofollow" class="random" style="padding:0 2px; color:' . $rand . '; background:' . $bgrand . ';" href="' . basename($_SERVER['SCRIPT_FILENAME']) . '?mode=hsl&h=' . $rand_h . '&s=' . $rand_s . '&l=' . $rand_l . '" rel="nofollow">random color</a><!--googleon: index-->'; }