Websafe Color Chart

Started on the old forum in March 2008 · view the original in the archive · old links redirect here

5 replies · 796 views · started 18 years ago · 1 min read

3 participants
Ghost Senior · 366 posts #1

i was bored couldnt get to sleep lol so read up on some php and created this websafe color chart the headers are in xhtml mobile 1.0 but this is just incase some mobiles come across the page you use it on..

DEMO: http://wapchat.uk.to/hex.php

SCRIPT:

<?php
   header("Content-type: text/html; charset=UTF-8");
   echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
          echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"
     \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";

/**
* @author Ghost
* @copyright 2008 - 2009 Ghost WebSafe Color Chart
* @version (XHTML Mobile 1.0//EN)
*/

echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n";
echo "<head>";
    echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />";
    echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />";
    echo "<title>Ghost WebSafe Colors</title>";

       // CSS FUNCTIONS FOR STYLESHEET
echo "<style type=\"text/css\">";

echo '
.body {
      background-attachment : fixed;
      background-color : #FFFFFF;
      background-image : url();
      background-position : center center;
      font-family : Georgia, "Times New Roman", Times, serif;
      font-size : small;
      font-style : normal;
      font-weight : normal;
      font-variant : normal;
      color : #0000A0;
      text-align : center;
      text-transform : none;
      text-decoration : none;
    }
.table {
      border : 0;
    }
a:link, a:visited, a:active {
      background : transparent;
      color : #FF0000;
      text-decoration : underline;
    }
';

echo "</style>";

echo "</head>";
          echo "<body class=\"body\">";

          //TIME TO USE A DIV TAG HERE
echo "<div>";

    /* here we add the digits to make up the color codes into
       an array to make it easier for use to simplify the code
       and also by doing this the server does most of the hard work lol */
$hexcolor = array("00", "33", "66", "99", "AA", "BB", "CC", "DD", "EE", "FF", "A0");

/* TITLE FOR SCRIPT (i havent added the color: code in the span style
this is because i decided to use the css code above) */
echo "<h1>Ghost Web Safe Color Chart</h1><hr/>";

/* instructions on use (i havent added the color: code in the span style
this is because i decided to use the css code above) */
echo "(Choose your color then copy and paste the code)<hr/>";

//time to open a table
echo "<table class=\"table\">";

//ok now we get the red colors loop
for ($red=0; $red<count($hexcolor); $red++){

//ok now we get the green colors loop
for ($green=0; $green<count($hexcolor); $green++){
echo "<tr>";

//ok now we Define a row for the six blue colors
for ($blue=0; $blue<count($hexcolor); $blue++){

//ok now we iterate through the six blue colors
$color = $hexcolor[$red].$hexcolor[$green].$hexcolor[$blue];

//ok now At this point we decide what text/font color to use
if ( $hexcolor[$red] <= "99" && $hexcolor[$green] <= "99" && $hexcolor[$blue] <= "99"){

//ok now we Use a white font if the color is going to be quite dark
echo "<td style=\"width:200px;background-color:#".$color.";\"> ".$color." </td>";
} else {

//ok now we Use a black font on the lighter colors
echo "<td style=\"width:200px;background-color:#".$color.";\"> ".$color." </td>";

//ok now we End the loop which is blue
}

//ok now we close row after writing the six color cells
}
echo "</tr>\n";
//ok now we End the loop which is green
}

//ok now we End the loop which is red
}
//time to close the table
echo "</table>\n";

         //MY COPYRIGHT
echo "© Ghost WebSafe Color Chart - ".date(Y);

       //NOW TIME TO CLOSE OUR EARLIER DIV TAG
  echo "</div>";

      echo "</body>\n";
   echo "</html>\n";
?>

ENJOY

edited: updated code..

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
metulj Super moderator Principal · 1,726 posts #2

i was bored couldnt get to sleep lol so read up on some php and created this websafe color chart the headers are in xhtml mobile 1.0 but this is just incase some mobiles come across the page you use it on..

DEMO: http://wapchat.uk.to/hex.php

SCRIPT: CODE

<?php header("Content-type: text/html; charset=UTF-8"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
	  echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"
 \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";

/**

  • @author Ghost
  • @copyright 2008 - 2009 Ghost WebSafe Color Chart
  • @version (XHTML Mobile 1.0//EN) */

echo "<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n"; echo "<head>"; echo "<meta http-equiv="content-type" content="text/html; charset=utf-8" />"; echo "<meta http-equiv="Cache-Control" content="no-cache" />"; echo "<title>Ghost WebSafe Colors</title>";

   // CSS FUNCTIONS FOR STYLESHEET

echo "<style type="text/css">";

echo ' .body { background-attachment : fixed; background-color : #FFFFFF; background-image : url(); background-position : center center; font-family : Georgia, "Times New Roman", Times, serif; font-size : small; font-style : normal; font-weight : normal; font-variant : normal; color : #0000A0; text-align : center; text-transform : none; text-decoration : none; } .table { border : 0; } a:link, a:visited, a:active { background : transparent; color : #FF0000; text-decoration : underline; } ';

echo "</style>";

echo "</head>"; echo "<body class="body">";

	  //TIME TO USE A DIV TAG HERE

echo "";

/* here we add the digits to make up the color codes into
   an array to make it easier for use to simplify the code
   and also by doing this the server does most of the hard work lol */

$hexcolor = array("00", "33", "66", "99", "AA", "BB", "CC", "DD", "EE", "FF", "A0");

// TITLE FOR SCRIPT echo "<h1>Ghost Web Safe Color Chart</h1><hr/>"; //time to open a table echo "<table class="table">";

//ok now we get the red colors loop for ($red=0; $red<count($hexcolor); $red++){

//ok now we get the green colors loop for ($green=0; $green<count($hexcolor); $green++){ echo "<tr>";

//ok now we Define a row for the six blue colors for ($blue=0; $blue<count($hexcolor); $blue++){

//ok now we iterate through the six blue colors $color = $hexcolor[$red].$hexcolor[$green].$hexcolor[$blue];

//ok now At this point we decide what text/font color to use if ( $hexcolor[$red] <= "99" && $hexcolor[$green] <= "99" && $hexcolor[$blue] <= "99"){

//ok now we Use a white font if the color is going to be quite dark echo "<td style="width:200px;background-color:#".$color.";"> ".$color." </td>"; } else {

//ok now we Use a black font on the lighter colors echo "<td style="width:200px;background-color:#".$color.";"> ".$color." </td>";

//ok now we End the loop which is blue }

//ok now we close row after writing the six color cells } echo "</tr>\n"; //ok now we End the loop which is green }

//ok now we End the loop which is red } //time to close the table echo "</table>\n";

	 //MY COPYRIGHT

echo "© Ghost WebSafe Color Chart - ".date(Y);

   //NOW TIME TO CLOSE OUR EARLIER DIV TAG

echo "";

  echo "</body>\n";

echo "</html>\n"; ?>

ENJOY

wow nice1! thanks External image (may be gone)

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

Ghost Senior · 366 posts #3

your welcome bro hope it comes in handy for someone like yourself.. enjoy..

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
amylee Principal · 1,092 posts #4

can a phone even open that page?

Ghost Senior · 366 posts #5

can a phone even open that page?

my phone does yes.. but this was made for pcs not phones persay.. but if you remove some letters out of the ARRAY ie: "AA" "EE" etc it will choose less colors and mobiles will defo be able to few it.. i have tried this and defo works amylee hun..

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
metulj Super moderator Principal · 1,726 posts #6

can a phone even open that page?

i've checked this on N70 with opera symbian and netfront and it show colors ok External image (may be gone)

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close