PHP generates tag tag functions with different colors and sizes
- 2020-09-28 08:48:59
- OfStack
function getTagStyle(){
$minFontSize=8; // Minimum font size , It can be changed as needed
$maxFontSize=18; // Maximum font size , It can be changed as needed
return 'font-size:'.($minFontSize+lcg_value()*(abs($maxFontSize-$minFontSize))).'px;color:#'.dechex(rand(0,255)).dechex(rand(0,196)).dechex(rand(0,255));
}
This function outputs random styles, including ES4en-ES5en and color.
If you want to specify that only a few font sizes are displayed, rather than being completely random, change the above function code to:
function getTagStyle(){
$sizearray = array('8','9','10','11','12','20'); // Customize the font size , It can be modified as required
return 'font-size:'.$sizearray[rand(0,count($sizearray))].'pt;color:#'.dechex(rand(0,255)).dechex(rand(0,196)).dechex(rand(0,255));
}