mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
Merge pull request #30034 from nextcloud/fix/bump-scssphp/scssphp-to-1.8.1
This commit is contained in:
commit
b067ae78c5
3 changed files with 43 additions and 8 deletions
2
3rdparty
2
3rdparty
|
|
@ -1 +1 @@
|
|||
Subproject commit 1269091e96a2a550912db37c0d2b29ed5c0aa60f
|
||||
Subproject commit 108a384f119a8bdad65210e7231a287f46ede73e
|
||||
|
|
@ -34,7 +34,6 @@ use OCP\Files\IAppData;
|
|||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\SimpleFS\ISimpleFile;
|
||||
use OCP\IConfig;
|
||||
use ScssPhp\ScssPhp\Compiler;
|
||||
|
||||
class Util {
|
||||
|
||||
|
|
@ -96,15 +95,52 @@ class Util {
|
|||
return $color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert RGB to HSL
|
||||
*
|
||||
* Copied from cssphp, copyright Leaf Corcoran, licensed under MIT
|
||||
*
|
||||
* @param integer $red
|
||||
* @param integer $green
|
||||
* @param integer $blue
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toHSL($red, $green, $blue) {
|
||||
$min = min($red, $green, $blue);
|
||||
$max = max($red, $green, $blue);
|
||||
$l = $min + $max;
|
||||
$d = $max - $min;
|
||||
|
||||
if ((int) $d === 0) {
|
||||
$h = $s = 0;
|
||||
} else {
|
||||
if ($l < 255) {
|
||||
$s = $d / $l;
|
||||
} else {
|
||||
$s = $d / (510 - $l);
|
||||
}
|
||||
|
||||
if ($red == $max) {
|
||||
$h = 60 * ($green - $blue) / $d;
|
||||
} elseif ($green == $max) {
|
||||
$h = 60 * ($blue - $red) / $d + 120;
|
||||
} else {
|
||||
$h = 60 * ($red - $green) / $d + 240;
|
||||
}
|
||||
}
|
||||
|
||||
return [fmod($h, 360), $s * 100, $l / 5.1];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $color rgb color value
|
||||
* @return float
|
||||
*/
|
||||
public function calculateLuminance($color) {
|
||||
[$red, $green, $blue] = $this->hexToRGB($color);
|
||||
$compiler = new Compiler();
|
||||
$hsl = $compiler->toHSL($red, $green, $blue);
|
||||
return $hsl[3] / 100;
|
||||
$hsl = $this->toHSL($red, $green, $blue);
|
||||
return $hsl[2] / 100;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ use OCP\ILogger;
|
|||
use OCP\IMemcache;
|
||||
use OCP\IURLGenerator;
|
||||
use ScssPhp\ScssPhp\Compiler;
|
||||
use ScssPhp\ScssPhp\Exception\ParserException;
|
||||
use ScssPhp\ScssPhp\OutputStyle;
|
||||
|
||||
class SCSSCacher {
|
||||
|
|
@ -340,7 +339,7 @@ class SCSSCacher {
|
|||
'@import "variables.scss";' .
|
||||
'@import "functions.scss";' .
|
||||
'@import "' . $fileNameSCSS . '";');
|
||||
} catch (ParserException $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['app' => 'scss_cacher']);
|
||||
|
||||
return false;
|
||||
|
|
@ -431,7 +430,7 @@ class SCSSCacher {
|
|||
$scss = new Compiler();
|
||||
$scss->compile($variables);
|
||||
$this->injectedVariables = $variables;
|
||||
} catch (ParserException $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['app' => 'scss_cacher']);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue