summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-11-07 16:12:51 +0100
committerGitHub <noreply@github.com>2017-11-07 16:12:51 +0100
commit8566f8b8ee421ae1549e988c92c494deaf2829c2 (patch)
tree9090bc9bcb8c6a0b83e8cbe8487828d31841e0c6 /apps
parentaa789989bfb37b9f8342b4539cf25478ff10288f (diff)
parent00956c00b240789ad29289b9c100c237b1843e1f (diff)
downloadnextcloud-server-8566f8b8ee421ae1549e988c92c494deaf2829c2.tar.gz
nextcloud-server-8566f8b8ee421ae1549e988c92c494deaf2829c2.zip
Merge pull request #7094 from nextcloud/theming-capabilities-element
Theming: expose element color though capabilities API
Diffstat (limited to 'apps')
-rw-r--r--apps/theming/lib/Capabilities.php7
-rw-r--r--apps/theming/lib/Util.php3
-rw-r--r--apps/theming/tests/CapabilitiesTest.php3
3 files changed, 8 insertions, 5 deletions
diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php
index bb06ab107ea..b43779a27b5 100644
--- a/apps/theming/lib/Capabilities.php
+++ b/apps/theming/lib/Capabilities.php
@@ -68,14 +68,15 @@ class Capabilities implements IPublicCapability {
*/
public function getCapabilities() {
$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false);
-
+ $color = $this->theming->getColorPrimary();
return [
'theming' => [
'name' => $this->theming->getName(),
'url' => $this->theming->getBaseUrl(),
'slogan' => $this->theming->getSlogan(),
- 'color' => $this->theming->getColorPrimary(),
- 'color-text' => $this->util->invertTextColor($this->theming->getColorPrimary()) ? '#000000' : '#FFFFFF',
+ 'color' => $color,
+ 'color-text' => $this->util->invertTextColor($color) ? '#000000' : '#FFFFFF',
+ 'color-element' => $this->util->elementColor($color),
'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()),
'background' => $backgroundLogo === 'backgroundColor' ?
$this->theming->getColorPrimary() :
diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php
index 5d0eba49ecd..194b5eeb0d0 100644
--- a/apps/theming/lib/Util.php
+++ b/apps/theming/lib/Util.php
@@ -81,9 +81,8 @@ class Util {
$l = $this->calculateLuminance($color);
if($l>0.8) {
return '#555555';
- } else {
- return $color;
}
+ return $color;
}
/**
diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php
index d0422652130..17fc253fa4f 100644
--- a/apps/theming/tests/CapabilitiesTest.php
+++ b/apps/theming/tests/CapabilitiesTest.php
@@ -71,6 +71,7 @@ class CapabilitiesTest extends TestCase {
'slogan' => 'slogan',
'color' => '#FFFFFF',
'color-text' => '#000000',
+ 'color-element' => '#555555',
'logo' => 'http://absolute/logo',
'background' => 'http://absolute/background',
]],
@@ -80,6 +81,7 @@ class CapabilitiesTest extends TestCase {
'slogan' => 'slogan3',
'color' => '#01e4a0',
'color-text' => '#FFFFFF',
+ 'color-element' => '#01e4a0',
'logo' => 'http://localhost/logo5',
'background' => 'http://localhost/background6',
]],
@@ -89,6 +91,7 @@ class CapabilitiesTest extends TestCase {
'slogan' => 'slogan3',
'color' => '#000000',
'color-text' => '#FFFFFF',
+ 'color-element' => '#000000',
'logo' => 'http://localhost/logo5',
'background' => '#000000',
]],