~zodiacsohma/armagetronad/arma_colors_to_html_codes

« back to all changes in this revision

Viewing changes to Converting RGB Colors to HTML Colors.php

  • Committer: zodiacsohma1 at gmail
  • Date: 2012-09-17 22:10:25 UTC
  • Revision ID: zodiacsohma1@gmail.com-20120917221025-eskwb8o24jzeixhy
Changed <font ... > tag to <span style="color:..."> as it seemed to be a lot easier to use.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
                                        $strPos = strlen($source_string);       // make the strpos the length of the entire source string
55
55
                                        
56
56
                                        // put the current color and the extra into $new_string
57
 
                                        $new_string .= '<font color="'.$colorCode.'">'.substr($source_string, $new_strPos, ($strPos - $new_strPos)).'</font>';  
 
57
                                        $new_string .= '<span style="color:'.$colorCode.'">'.substr($source_string, $new_strPos, ($strPos - $new_strPos)).'</span>';    
58
58
                                        $chars += ($strPos - $new_strPos);
59
59
                                        $strPos = false;                //now turn this back to it's original value, false
60
60
                                }
61
61
                                else            // if there is another
62
62
                                {
63
63
                                        // put the current color and the extra into $new_string
64
 
                                        $new_string .= '<font color="'.$colorCode.'">'.substr($source_string, $new_strPos, ($strPos - $new_strPos)).'</font>';
 
64
                                        $new_string .= '<span style="color:'.$colorCode.'">'.substr($source_string, $new_strPos, ($strPos - $new_strPos)).'</span>';
65
65
                                        $chars += ($strPos - $new_strPos);
66
66
                                }
67
67
                                $firstTime = false;
82
82
                                if ($strPos == false)
83
83
                                {
84
84
                                        $strPos = strlen($source_string);
85
 
                                        $new_string .= '<font color="'.$colorCode.'">'.substr($source_string, $new_strPos, ($strPos - $new_strPos)).'</font>';
 
85
                                        $new_string .= '<span style="color:'.$colorCode.'">'.substr($source_string, $new_strPos, ($strPos - $new_strPos)).'</span>';
86
86
                                        $chars += ($strPos - $new_strPos);
87
87
                                        $strPos = false;
88
88
                                }
89
89
                                else
90
90
                                {
91
 
                                        $new_string .= '<font color="'.$colorCode.'">'.substr($source_string, $new_strPos, ($strPos - $new_strPos)).'</font>';
 
91
                                        $new_string .= '<span style="color:'.$colorCode.'">'.substr($source_string, $new_strPos, ($strPos - $new_strPos)).'</span>';
92
92
                                        $chars += ($strPos - $new_strPos);
93
93
                                }
94
94
                        }