diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 2cf0b1708..8f7488723 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -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 *