summaryrefslogtreecommitdiffstats
path: root/apps/theming/lib/ThemingDefaults.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/lib/ThemingDefaults.php')
-rw-r--r--apps/theming/lib/ThemingDefaults.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 1df7a9f17bb..5a14e8a7903 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -275,7 +275,7 @@ class ThemingDefaults extends \OC_Defaults {
'theming-favicon-mime' => "'" . $this->config->getAppValue('theming', 'faviconMime') . "'"
];
- $variables['image-logo'] = "url('".$this->imageManager->getImageUrl('logo')."')";
+ $variables['image-logo'] = "url('". $this->getLogoUrl() ."')";
$variables['image-logoheader'] = "'".$this->imageManager->getImageUrl('logoheader')."'";
$variables['image-favicon'] = "'".$this->imageManager->getImageUrl('favicon')."'";
$variables['image-login-background'] = "url('".$this->imageManager->getImageUrl('background')."')";
@@ -301,6 +301,24 @@ class ThemingDefaults extends \OC_Defaults {
}
/**
+ * Returns the logo url.
+ * If there is a custom logo, it just returns it.
+ * For the default logo it returns the white or blue one depending on the color luminance.
+ *
+ * @return string
+ */
+ private function getLogoUrl() {
+ $logoMime = $this->config->getAppValue('theming', 'logoMime');
+ $primaryColor = $this->getColorPrimary();
+ $luminance = $this->util->calculateLuminance($primaryColor);
+ if ($logoMime === '' & $luminance > 0.8) {
+ return $this->imageManager->getImageUrl('logo-blue');
+ } else {
+ return $this->imageManager->getImageUrl('logo');
+ }
+ }
+
+ /**
* Check if the image should be replaced by the theming app
* and return the new image location then
*