Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-08-04 16:38:08 +0300
committerGitHub <noreply@github.com>2017-08-04 16:38:08 +0300
commit9b57d33631f68460001b9574e05eac182d4310ed (patch)
treeb9ea947ff1cf7a110a24bddb3f533bff8df8915e
parent0fabfaba69aaae940f8c47ceb0582c986ce0487c (diff)
parent796f0f93336f3a6d7b954f0c673bec04a3e17147 (diff)
Merge pull request #5977 from nextcloud/stable12-theming-lightness-correction
[stable12] theming lightness correction
-rw-r--r--apps/theming/lib/Util.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php
index 286756a4849..e5fa90cb344 100644
--- a/apps/theming/lib/Util.php
+++ b/apps/theming/lib/Util.php
@@ -30,6 +30,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IConfig;
use OCP\Files\IRootFolder;
+use Leafo\ScssPhp\Compiler;
class Util {
@@ -95,10 +96,12 @@ class Util {
if (strlen($hex) !== 6) {
return 0;
}
- $r = hexdec(substr($hex, 0, 2));
- $g = hexdec(substr($hex, 2, 2));
- $b = hexdec(substr($hex, 4, 2));
- return (0.299 * $r + 0.587 * $g + 0.114 * $b)/255;
+ $red = hexdec(substr($hex, 0, 2));
+ $green = hexdec(substr($hex, 2, 2));
+ $blue = hexdec(substr($hex, 4, 2));
+ $compiler = new Compiler();
+ $hsl = $compiler->toHSL($red, $green, $blue);
+ return $hsl[3]/100;
}
/**