Jump to content

Setting the color for an ASCII char


ThunderAI

Recommended Posts

I have the following code:

 

$str 		= ($stringcontents[$step+38]);
$str1	= ord($str);
$bgcolor	= convertchar($str1);
?>
<td bgcolor='<?php echo $bgcolor;?>'>
<span title='<?php echo $fieldname;?>' style='color: <?php echo $fgcolor;?>; font-size: 12pt'><font color="<?php echo $fgcolor;?>"><?php echo $stringcontents[$step];?></font></span>				

 

the convertchar function takes the ord value of the ASCII chr and sets a variable for bgcolor and fgcolor using HTML color codes.  The background sets correctly, but the foreground ASCII chr is always black and does not use the font color code.

 

What do I need to do to get the ASCII chr to change to a color other than black?

 

 

Added:

I am using a default charset:

 

<META http-equiv="Content-Type" content="text/html; charset=IBM437">

Link to comment
https://forums.phpfreaks.com/topic/211940-setting-the-color-for-an-ascii-char/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.