mIRC Homepage
Posted By: whatnot convert color code to html - 30/05/15 10:17 AM
hello I been try to work out how to convert color code to html
I'v had some luck and not so luck can anyone help me please?
Here my code

Code:
<style>
/*control codes*/
.bg0 {
    background-color: white;
}
.bg1 {
    background-color: black;
}
.bg2 {
    background-color: navy;
}
.bg3 {
    background-color: green;
}
.bg4 {
    background-color: red;
}
.bg5 {
    background-color: brown;
}
.bg6 {
    background-color: purple;
}
.bg7 {
    background-color: orange;
}
.bg8 {
    background-color: yellow;
}
.bg9 {
    background-color: lime;
}
.bg10 {
    background-color: teal;
}
.bg11 {
    background-color: lightcyan;
}
.bg12 {
    background-color: blue;
}
.bg13 {
    background-color: pink;
}
.bg14 {
    background-color: grey;
}
.bg15 {
    background-color: lightgrey;
}
.fg0 {
    color: white;
}
.fg1 {
    color: black;
}
.fg2 {
    color: navy;
}
.fg3 {
    color: green;
}
.fg4 {
    color: red;
}
.fg5 {
    color: brown;
}
.fg6 {
    color: purple;
}
.fg7 {
    color: orange;
}
.fg8 {
    color: yellow;
}
.fg9 {
    color: lime;
}
.fg10 {
    color: teal;
}
.fg11 {
    color: lightcyan;
}
.fg12 {
    color: blue;
}
.fg13 {
    color: pink;
}
.fg14 {
    color: grey;
}
.fg15 {
    color: lightgrey;
}
</style>
<?php
error_reporting(E_ALL ^ E_NOTICE);
        $botnick = "RoomLister";
        $server = "irc.bumblebeechat.net";
        $port = "7000";
        $channel = "bumblebee";
?>

<br clear=all>
<div class="container">
<table width="98%" class="table table-bordered">
  <tr class="warning">
        <td width="8%" height="20" align="center" valign="middle">&nbsp;Users</td>
        <td width="15%" height="20" align="left" valign="middle">&nbsp;Roomname:</td>
        <td width="77%" height="20" align="left" valign="middle">&nbsp;Topic:</td>
  </tr>
<?php
        $fp = fsockopen($server, $port, $errno, $errstr, 30);
        if (!$fp) {
                        echo "$errstr ($errno)<br clear=all>\n";
        }
        else {
                        fputs($fp,"USER $botnick $botnick 127.0.0.1 :php\n");
                        $nick = $botnick . rand(10000,99999);
                        fputs($fp,"NICK $nick\n");
                        while (!feof($fp)) {
                                        usleep(50);
                                        $fget = @fgets($fp, 500);
                                        //echo "$fget <br>\n";
                                        $match = explode(" ", $fget);
                                        $fget = str_replace ("\n", "", $fget);
                                        $fget = str_replace ("\r", "", $fget);
                                        if ($match[1] == "001") {
                                                        fputs($fp,"LIST\n");
                                        }
else if ($match[0] == "PING") {
                                                        fputs($fp, "PONG " . $match[1]);
                                        }
                                        else if ($match[1] == "433") {
                                                        $nick = $botnick . rand(10000,99999);
                                                        fputs($fp,"NICK $nick\n");
                                        }
                                        else if ($match[1] == "323") {
                                                        fputs($fp, "QUIT :bye!\n");
                                                        break;
                                        }
                                        else if ($match[1] == "322") {
                                         $room = $match[3];
                                         $room = str_replace("#","",$room);
          $count = $match[4];
          $topic = explode(":", $fget);
                                         unset($topic[0]);
                                         unset($topic[1]);
                                         $topic = implode(":", $topic);
                                         $topic = str_replace('0','<span class="fg0">',$topic);
                                         $topic = str_replace('1','<span class="fg1">',$topic);
                                         $topic = str_replace('2','<span class="fg2">',$topic);
                                         $topic = str_replace('3','<span class="fg3">',$topic);
                                         $topic = str_replace('4','<span class="fg4">',$topic);
                                         $topic = str_replace('5','<span class="fg5">',$topic);
                                         $topic = str_replace('6','<span class="fg6">',$topic);
                                         $topic = str_replace('7','<span class="fg7">',$topic);
                                         $topic = str_replace('8','<span class="fg8">',$topic);
                                         $topic = str_replace('9','<span class="fg9">',$topic);
                                         $topic = str_replace('10','<span class="fg10">',$topic);
                                         $topic = str_replace('11','<span class="fg11">',$topic);
                                         $topic = str_replace('12','<span class="fg12">',$topic);
                                         $topic = str_replace('13','<span class="fg13">',$topic);
                                         $topic = str_replace('14','<span class="fg14">',$topic);
                                         $topic = str_replace('15','<span class="fg15">',$topic);
                                         $topic = str_replace('0,0','<span class="fg0 bg0">',$topic);
                                         $topic = str_replace('0,1','<span class="fg0 bg1">',$topic);
                                         $topic = str_replace('0,2','<span class="fg0 bg2">',$topic);
                                         $topic = str_replace('0,3','<span class="fg0 bg3">',$topic);
                                         $topic = str_replace('0,4','<span class="fg0 bg4">',$topic);
                                         $topic = str_replace('0,5','<span class="fg0 bg5">',$topic);
                                         $topic = str_replace('0,6','<span class="fg0 bg6">',$topic);
                                         $topic = str_replace('0,7','<span class="fg0 bg7">',$topic);
                                         $topic = str_replace('0,8','<span class="fg0 bg8">',$topic);
                                         $topic = str_replace('0,9','<span class="fg0 bg9">',$topic);
                                         $topic = str_replace('0,10','<span class="fg0 bg10">',$topic);
                                         $topic = str_replace('0,11','<span class="fg0 bg11">',$topic);
                                         $topic = str_replace('0,12','<span class="fg0 bg12">',$topic);
                                         $topic = str_replace('0,13','<span class="fg0 bg13">',$topic);
                                         $topic = str_replace('0,14','<span class="fg0 bg14">',$topic);
                                         $topic = str_replace('0,15','<span class="fg0 bg15">',$topic);
                                         $topic = str_replace('1,0','<span class="fg1 bg0">',$topic);
                                         $topic = str_replace('1,1','<span class="fg1 bg1">',$topic);
                                         $topic = str_replace('1,2','<span class="fg1 bg2">',$topic);
                                         $topic = str_replace('1,3','<span class="fg1 bg3">',$topic);
                                         $topic = str_replace('1,4','<span class="fg1 bg4">',$topic);
                                         $topic = str_replace('1,5','<span class="fg1 bg5">',$topic);
                                         $topic = str_replace('1,6','<span class="fg1 bg6">',$topic);
                                         $topic = str_replace('1,7','<span class="fg1 bg7">',$topic);
                                         $topic = str_replace('1,8','<span class="fg1 bg8">',$topic);
                                         $topic = str_replace('1,9','<span class="fg1 bg9">',$topic);
                                         $topic = str_replace('1,10','<span class="fg1 bg10">',$topic);
                                         $topic = str_replace('1,11','<span class="fg1 bg11">',$topic);
                                         $topic = str_replace('1,12','<span class="fg1 bg12">',$topic);
                                         $topic = str_replace('1,13','<span class="fg1 bg13">',$topic);
                                         $topic = str_replace('1,14','<span class="fg1 bg14">',$topic);
                                         $topic = str_replace('1,15','<span class="fg1 bg15">',$topic);
                                         $topic = str_replace('2,0','<span class="fg2 bg0">',$topic);
                                         $topic = str_replace('2,1','<span class="fg2 bg1">',$topic);
                                         $topic = str_replace('2,2','<span class="fg2 bg2">',$topic);
                                         $topic = str_replace('2,3','<span class="fg2 bg3">',$topic);
                                         $topic = str_replace('2,4','<span class="fg2 bg4">',$topic);
                                         $topic = str_replace('2,5','<span class="fg2 bg5">',$topic);
                                         $topic = str_replace('2,6','<span class="fg2 bg6">',$topic);
                                         $topic = str_replace('2,7','<span class="fg2 bg7">',$topic);
                                         $topic = str_replace('2,8','<span class="fg2 bg8">',$topic);
                                         $topic = str_replace('2,9','<span class="fg2 bg9">',$topic);
                                         $topic = str_replace('2,10','<span class="fg2 bg10">',$topic);
                                         $topic = str_replace('2,11','<span class="fg2 bg11">',$topic);
                                         $topic = str_replace('2,12','<span class="fg2 bg12">',$topic);
                                         $topic = str_replace('2,13','<span class="fg2 bg13">',$topic);
                                         $topic = str_replace('2,14','<span class="fg2 bg14">',$topic);
                                         $topic = str_replace('2,15','<span class="fg2 bg15">',$topic);
                                         $topic = str_replace('3,0','<span class="fg3 bg0">',$topic);
                                         $topic = str_replace('3,1','<span class="fg3 bg1">',$topic);
                                         $topic = str_replace('3,2','<span class="fg3 bg2">',$topic);
                                         $topic = str_replace('3,3','<span class="fg3 bg3">',$topic);
                                         $topic = str_replace('3,4','<span class="fg3 bg4">',$topic);
                                         $topic = str_replace('3,5','<span class="fg3 bg5">',$topic);
                                         $topic = str_replace('3,6','<span class="fg3 bg6">',$topic);
                                         $topic = str_replace('3,7','<span class="fg3 bg7">',$topic);
                                         $topic = str_replace('3,8','<span class="fg3 bg8">',$topic);
                                         $topic = str_replace('3,9','<span class="fg3 bg9">',$topic);
                                         $topic = str_replace('3,10','<span class="fg3 bg10">',$topic);
                                         $topic = str_replace('3,11','<span class="fg3 bg11">',$topic);
                                         $topic = str_replace('3,12','<span class="fg3 bg12">',$topic);
                                         $topic = str_replace('3,13','<span class="fg3 bg13">',$topic);
                                         $topic = str_replace('3,14','<span class="fg3 bg14">',$topic);
                                         $topic = str_replace('3,15','<span class="fg3 bg15">',$topic);
                                         $topic = str_replace('4,0','<span class="fg4 bg0">',$topic);
                                         $topic = str_replace('4,1','<span class="fg4 bg1">',$topic);
                                         $topic = str_replace('4,2','<span class="fg4 bg2">',$topic);
                                         $topic = str_replace('4,3','<span class="fg4 bg3">',$topic);
                                         $topic = str_replace('4,4','<span class="fg4 bg4">',$topic);
                                         $topic = str_replace('4,5','<span class="fg4 bg5">',$topic);
                                         $topic = str_replace('4,6','<span class="fg4 bg6">',$topic);
                                         $topic = str_replace('4,7','<span class="fg4 bg7">',$topic);
                                         $topic = str_replace('4,8','<span class="fg4 bg8">',$topic);
                                         $topic = str_replace('4,9','<span class="fg4 bg9">',$topic);
                                         $topic = str_replace('4,10','<span class="fg4 bg10">',$topic);
                                         $topic = str_replace('4,11','<span class="fg4 bg11">',$topic);
                                         $topic = str_replace('4,12','<span class="fg4 bg12">',$topic);
                                         $topic = str_replace('4,13','<span class="fg4 bg13">',$topic);
                                         $topic = str_replace('4,14','<span class="fg4 bg14">',$topic);
                                         $topic = str_replace('4,15','<span class="fg4 bg15">',$topic);
                                         $topic = str_replace('5,0','<span class="fg5 bg0">',$topic);
                                         $topic = str_replace('5,1','<span class="fg5 bg1">',$topic);
                                         $topic = str_replace('5,2','<span class="fg5 bg2">',$topic);
                                         $topic = str_replace('5,3','<span class="fg5 bg3">',$topic);
                                         $topic = str_replace('5,4','<span class="fg5 bg4">',$topic);
                                         $topic = str_replace('5,5','<span class="fg5 bg5">',$topic);
                                         $topic = str_replace('5,6','<span class="fg5 bg6">',$topic);
                                         $topic = str_replace('5,7','<span class="fg5 bg7">',$topic);
                                         $topic = str_replace('5,8','<span class="fg5 bg8">',$topic);
                                         $topic = str_replace('5,9','<span class="fg5 bg9">',$topic);
                                         $topic = str_replace('5,10','<span class="fg5 bg10">',$topic);
                                         $topic = str_replace('5,11','<span class="fg5 bg11">',$topic);
                                         $topic = str_replace('5,12','<span class="fg5 bg12">',$topic);
                                         $topic = str_replace('5,13','<span class="fg5 bg13">',$topic);
                                         $topic = str_replace('5,14','<span class="fg5 bg14">',$topic);
                                         $topic = str_replace('5,15','<span class="fg5 bg15">',$topic);
                                         $topic = str_replace('6,0','<span class="fg6 bg0">',$topic);
                                         $topic = str_replace('6,1','<span class="fg6 bg1">',$topic);
                                         $topic = str_replace('6,2','<span class="fg6 bg2">',$topic);
                                         $topic = str_replace('6,3','<span class="fg6 bg3">',$topic);
                                         $topic = str_replace('6,4','<span class="fg6 bg4">',$topic);
                                         $topic = str_replace('6,5','<span class="fg6 bg5">',$topic);
                                         $topic = str_replace('6,6','<span class="fg6 bg6">',$topic);
                                         $topic = str_replace('6,7','<span class="fg6 bg7">',$topic);
                                         $topic = str_replace('6,8','<span class="fg6 bg8">',$topic);
                                         $topic = str_replace('6,9','<span class="fg6 bg9">',$topic);
                                         $topic = str_replace('6,10','<span class="fg6 bg10">',$topic);
                                         $topic = str_replace('6,11','<span class="fg6 bg11">',$topic);
                                         $topic = str_replace('6,12','<span class="fg6 bg12">',$topic);
                                         $topic = str_replace('6,13','<span class="fg6 bg13">',$topic);
                                         $topic = str_replace('6,14','<span class="fg6 bg14">',$topic);
                                         $topic = str_replace('6,15','<span class="fg6 bg15">',$topic);
                                         $topic = str_replace('7,0','<span class="fg7 bg0">',$topic);
                                         $topic = str_replace('7,1','<span class="fg7 bg1">',$topic);
                                         $topic = str_replace('7,2','<span class="fg7 bg2">',$topic);
                                         $topic = str_replace('7,3','<span class="fg7 bg3">',$topic);
                                         $topic = str_replace('7,4','<span class="fg7 bg4">',$topic);
                                         $topic = str_replace('7,5','<span class="fg7 bg5">',$topic);
                                         $topic = str_replace('7,6','<span class="fg7 bg6">',$topic);
                                         $topic = str_replace('7,7','<span class="fg7 bg7">',$topic);
                                         $topic = str_replace('7,8','<span class="fg7 bg8">',$topic);
                                         $topic = str_replace('7,9','<span class="fg7 bg9">',$topic);
                                         $topic = str_replace('7,10','<span class="fg7 bg10">',$topic);
                                         $topic = str_replace('7,11','<span class="fg7 bg11">',$topic);
                                         $topic = str_replace('7,12','<span class="fg7 bg12">',$topic);
                                         $topic = str_replace('7,13','<span class="fg7 bg13">',$topic);
                                         $topic = str_replace('7,14','<span class="fg7 bg14">',$topic);
                                         $topic = str_replace('7,15','<span class="fg7 bg15">',$topic);
                                         $topic = str_replace('8,0','<span class="fg8 bg0">',$topic);
                                         $topic = str_replace('8,1','<span class="fg8 bg1">',$topic);
                                         $topic = str_replace('8,2','<span class="fg8 bg2">',$topic);
                                         $topic = str_replace('8,3','<span class="fg8 bg3">',$topic);
                                         $topic = str_replace('8,4','<span class="fg8 bg4">',$topic);
                                         $topic = str_replace('8,5','<span class="fg8 bg5">',$topic);
                                         $topic = str_replace('8,6','<span class="fg8 bg6">',$topic);
                                         $topic = str_replace('8,7','<span class="fg8 bg7">',$topic);
                                         $topic = str_replace('8,8','<span class="fg8 bg8">',$topic);
                                         $topic = str_replace('8,9','<span class="fg8 bg9">',$topic);
                                         $topic = str_replace('8,10','<span class="fg8 bg10">',$topic);
                                         $topic = str_replace('8,11','<span class="fg8 bg11">',$topic);
                                         $topic = str_replace('8,12','<span class="fg8 bg12">',$topic);
                                         $topic = str_replace('8,13','<span class="fg8 bg13">',$topic);
                                         $topic = str_replace('8,14','<span class="fg8 bg14">',$topic);
                                         $topic = str_replace('8,15','<span class="fg8 bg15">',$topic);
                                         $topic = str_replace('9,0','<span class="fg9 bg0">',$topic);
                                         $topic = str_replace('9,1','<span class="fg9 bg1">',$topic);
                                         $topic = str_replace('9,2','<span class="fg9 bg2">',$topic);
                                         $topic = str_replace('9,3','<span class="fg9 bg3">',$topic);
                                         $topic = str_replace('9,4','<span class="fg9 bg4">',$topic);
                                         $topic = str_replace('9,5','<span class="fg9 bg5">',$topic);
                                         $topic = str_replace('9,6','<span class="fg9 bg6">',$topic);
                                         $topic = str_replace('9,7','<span class="fg9 bg7">',$topic);
                                         $topic = str_replace('9,8','<span class="fg9 bg8">',$topic);
                                         $topic = str_replace('9,9','<span class="fg9 bg9">',$topic);
                                         $topic = str_replace('9,10','<span class="fg9 bg10">',$topic);
                                         $topic = str_replace('9,11','<span class="fg9 bg11">',$topic);
                                         $topic = str_replace('9,12','<span class="fg9 bg12">',$topic);
                                         $topic = str_replace('9,13','<span class="fg9 bg13">',$topic);
                                         $topic = str_replace('9,14','<span class="fg9 bg14">',$topic);
                                         $topic = str_replace('9,15','<span class="fg9 bg15">',$topic);
                                          if ($color == "FBFBF7") {
                                                                                        $color = "FFFFFF";
                                                                        }
                                                                        else {
                                                                                        $color = "FBFBF7";
                                                                        }
                                                                        ?>

  <tr>
        <td width="8%" align="center" valign="middle" bgcolor="#<?php echo $color; ?>"><div style="min-height: 50px;"><?php echo $count; ?></div></td>
        <td width="15%" bgcolor="#<?php echo $color; ?>">&nbsp;<a href="chat.php?rm=<?php echo $room; ?>">
                  <?php echo $room; ?>
                  </a></td>
        <td width="77%" bgcolor="#<?php echo $color; ?>">&nbsp;
                  <?php echo $topic; ?></td>
  </tr>
                                                                                  <?php
                                                        }
                  
                        }
                        fclose($fp);
        }
?>

</table>
</div>

Many Thanks For Help
© mIRC Discussion Forums