Skip to content

Instantly share code, notes, and snippets.

@feryardiant
Last active August 29, 2015 14:02
Show Gist options
  • Save feryardiant/8a8c63ed7b999e35a586 to your computer and use it in GitHub Desktop.
Save feryardiant/8a8c63ed7b999e35a586 to your computer and use it in GitHub Desktop.
<?php
$colors = array();
for ($i = 0; $i <= 256; $i++) {
$colors[] = $i;
}
?>
<ul style="list-style: none; width: 900px; margin: 0 auto; padding: 0;">
<?php
foreach ($colors as $color) :
$bekgron = 'rgb('.$color.', '.$color.', '.$color.')';
$text = ($color < 128 ? '#fff' : '#000');
?>
<li style="width: 148px; float: left; display: inline-block; border: 1px solid <?php echo $text ?>;">
<span style="line-height: 1.8em; width: 100%; text-align: center; color: <?php echo $text ?>; display: block; background: <?php echo $bekgron ?>"><?php echo $bekgron ?></span>
</li>
<?php endforeach ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment