Ignore:
Timestamp:
Feb 10, 2022 1:48:35 AM (2 years ago)
Author:
anonymous
Message:

Minor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1dev/lib/Utilities.inc.php

    r756 r759  
    292292 *
    293293 * @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 */
     297function getTextColor($text, $method=1, $n=0.87)
    298298{
    299299    $hash = md5($text);
     
    310310    case 1 :
    311311    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        });
    314316        break;
    315317    case 2 :
Note: See TracChangeset for help on using the changeset viewer.