Merge pull request #7094 from nextcloud/theming-capabilities-element
Theming: expose element color though capabilities API
This commit is contained in:
commit
8566f8b8ee
|
@ -68,14 +68,15 @@ class Capabilities implements IPublicCapability {
|
||||||
*/
|
*/
|
||||||
public function getCapabilities() {
|
public function getCapabilities() {
|
||||||
$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false);
|
$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false);
|
||||||
|
$color = $this->theming->getColorPrimary();
|
||||||
return [
|
return [
|
||||||
'theming' => [
|
'theming' => [
|
||||||
'name' => $this->theming->getName(),
|
'name' => $this->theming->getName(),
|
||||||
'url' => $this->theming->getBaseUrl(),
|
'url' => $this->theming->getBaseUrl(),
|
||||||
'slogan' => $this->theming->getSlogan(),
|
'slogan' => $this->theming->getSlogan(),
|
||||||
'color' => $this->theming->getColorPrimary(),
|
'color' => $color,
|
||||||
'color-text' => $this->util->invertTextColor($this->theming->getColorPrimary()) ? '#000000' : '#FFFFFF',
|
'color-text' => $this->util->invertTextColor($color) ? '#000000' : '#FFFFFF',
|
||||||
|
'color-element' => $this->util->elementColor($color),
|
||||||
'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()),
|
'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()),
|
||||||
'background' => $backgroundLogo === 'backgroundColor' ?
|
'background' => $backgroundLogo === 'backgroundColor' ?
|
||||||
$this->theming->getColorPrimary() :
|
$this->theming->getColorPrimary() :
|
||||||
|
|
|
@ -81,9 +81,8 @@ class Util {
|
||||||
$l = $this->calculateLuminance($color);
|
$l = $this->calculateLuminance($color);
|
||||||
if($l>0.8) {
|
if($l>0.8) {
|
||||||
return '#555555';
|
return '#555555';
|
||||||
} else {
|
|
||||||
return $color;
|
|
||||||
}
|
}
|
||||||
|
return $color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -71,6 +71,7 @@ class CapabilitiesTest extends TestCase {
|
||||||
'slogan' => 'slogan',
|
'slogan' => 'slogan',
|
||||||
'color' => '#FFFFFF',
|
'color' => '#FFFFFF',
|
||||||
'color-text' => '#000000',
|
'color-text' => '#000000',
|
||||||
|
'color-element' => '#555555',
|
||||||
'logo' => 'http://absolute/logo',
|
'logo' => 'http://absolute/logo',
|
||||||
'background' => 'http://absolute/background',
|
'background' => 'http://absolute/background',
|
||||||
]],
|
]],
|
||||||
|
@ -80,6 +81,7 @@ class CapabilitiesTest extends TestCase {
|
||||||
'slogan' => 'slogan3',
|
'slogan' => 'slogan3',
|
||||||
'color' => '#01e4a0',
|
'color' => '#01e4a0',
|
||||||
'color-text' => '#FFFFFF',
|
'color-text' => '#FFFFFF',
|
||||||
|
'color-element' => '#01e4a0',
|
||||||
'logo' => 'http://localhost/logo5',
|
'logo' => 'http://localhost/logo5',
|
||||||
'background' => 'http://localhost/background6',
|
'background' => 'http://localhost/background6',
|
||||||
]],
|
]],
|
||||||
|
@ -89,6 +91,7 @@ class CapabilitiesTest extends TestCase {
|
||||||
'slogan' => 'slogan3',
|
'slogan' => 'slogan3',
|
||||||
'color' => '#000000',
|
'color' => '#000000',
|
||||||
'color-text' => '#FFFFFF',
|
'color-text' => '#FFFFFF',
|
||||||
|
'color-element' => '#000000',
|
||||||
'logo' => 'http://localhost/logo5',
|
'logo' => 'http://localhost/logo5',
|
||||||
'background' => '#000000',
|
'background' => '#000000',
|
||||||
]],
|
]],
|
||||||
|
|
Loading…
Reference in New Issue