Changeset 759 for branches/1.1dev/lib/Utilities.inc.php
- Timestamp:
- Feb 10, 2022 1:48:35 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1dev/lib/Utilities.inc.php
r756 r759 292 292 * 293 293 * @param string $text A string for which to convert to color. 294 * 295 * @return string A hexadecimal html color.296 */ 297 function getTextColor($text, $method=1 )294 * @param float $n Brightness value between 0-1. 295 * @return string A hexadecimal html color. 296 */ 297 function getTextColor($text, $method=1, $n=0.87) 298 298 { 299 299 $hash = md5($text); … … 310 310 case 1 : 311 311 default : 312 // Reduce all hex values slighly to avoid all white. 313 array_walk($rgb, create_function('&$v', '$v = dechex(round(hexdec($v) * 0.87));')); 312 // Reduce all hex values slightly to avoid all white. 313 array_walk($rgb, function (&$v) use ($n) { 314 $v = dechex(round(hexdec($v) * $n)); 315 }); 314 316 break; 315 317 case 2 :
Note: See TracChangeset
for help on using the changeset viewer.