add method getColorBrightness()

This commit is contained in:
Uwe Steinmann 2021-07-14 20:24:37 +02:00
parent 0b814df0c6
commit 45b3e55e66

View File

@ -922,6 +922,14 @@ function getMandatoryApprovers($folder, $user) { /* {{{ */
return $approvers;
} /* }}} */
function getColorBrightness($color) { /* {{{ */
$red = hexdec(substr($color, 1, 2))/255.0;
$green = hexdec(substr($color, 3, 2))/255.0;
$blue = hexdec(substr($color, 5, 2))/255.0;
$brightness = sqrt(0.299*pow($red, 2) + 0.587*pow($green, 2) + 0.114*pow($blue, 2));
return $brightness;
} /* }}} */
/**
* Class for creating encrypted api keys
*