Jump to content

Color chart


nuxy

Recommended Posts

Hello there,

 

I was just thinking that I wanted to make an color chart, that you would be able to give a color code for text, and the script will display the background color code from a cell.

Bit confusing, but never the less, this is just some personal think I would like to make for myself.

 

I have worked out a way to display all the colors, based on the number of characters in a color code, versus the available character you can use.

But I wanted to know if I could in a way, group the colors.

Like shades of red goes together, shades of green, blue, yellow, white and so forth.

 

I'm not an expert with what codes produce what colors, so this is a bit frustrating for me.

Here is my current script.

<?php
  $codes = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F');
  $read = array();
  echo '<table style="background:#1d1d1d;border-spacing:5px"><tr>';
  for ($s = 0; $s <= 1536; $s++) {
      $c++;
      while (strlen($string) != 6) {
          $string .= $codes[rand(0, 16)];
      }
      if (!in_array($string, $read)) {
          echo '<td style="font-family:tahoma;font-size:9px;color:#' . $_GET['c'] . ';text-align:center;padding:5px;width:40px;heigth:20px;background-color: #' . $string . ';">#' . $string . '</td> ';
          $read[] = $string;
          unset($string);
      }
      if ($c == 20) {
          echo '
   </tr><tr>';
          $c = 0;
      }
  }
  echo '</table>';
?>

 

Anyone have any ideas?

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.