mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Improve output of gradient.
This commit is contained in:
parent
2c1d016d41
commit
8f9057c7b8
@ -114,6 +114,10 @@ public static function gradient($string, $start, $end) {
|
||||
$string = self::str_split($string);
|
||||
if (count($string) === 0) return '';
|
||||
|
||||
if ($start === $end) {
|
||||
return '<span style="color:rgb('.($start >> 16 & 255).','.($start >> 8 & 255).','.($start & 255).')">'.\wcf\util\StringUtil::encodeHTML($string).'</span>'
|
||||
}
|
||||
|
||||
$r = (int) ((($start >> 16 & 255) - ($end >> 16 & 255)) / (count($string) - 1));
|
||||
$g = (int) ((($start >> 8 & 255) - ($end >> 8 & 255)) / (count($string) - 1));
|
||||
$b = (int) ((($start & 255) - ($end & 255)) / (count($string) - 1));
|
||||
|
Loading…
Reference in New Issue
Block a user