summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-12-18 21:19:51 +0100
committerGitHub <noreply@github.com>2017-12-18 21:19:51 +0100
commit6859e5a22a862b02ecd8e912b0f09e30560fb0b8 (patch)
treeb0f8c161e26506104d8840d83b005d53e9dc8d07 /apps
parent3a99ef528646bac4e3f8f7d100fa5ce04894f1dd (diff)
parente726d191f13fc0e6f79436625d734faa8f284a58 (diff)
downloadnextcloud-server-6859e5a22a862b02ecd8e912b0f09e30560fb0b8.tar.gz
nextcloud-server-6859e5a22a862b02ecd8e912b0f09e30560fb0b8.zip
Merge pull request #7558 from nextcloud/12-7427
[stable12] Fix email buttons for white theme
Diffstat (limited to 'apps')
-rw-r--r--apps/theming/lib/Capabilities.php2
-rw-r--r--apps/theming/lib/ThemingDefaults.php16
-rw-r--r--apps/theming/tests/CapabilitiesTest.php16
3 files changed, 21 insertions, 13 deletions
diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php
index 58fc5feeec9..cc938db1af2 100644
--- a/apps/theming/lib/Capabilities.php
+++ b/apps/theming/lib/Capabilities.php
@@ -73,7 +73,7 @@ class Capabilities implements ICapability {
'url' => $this->theming->getBaseUrl(),
'slogan' => $this->theming->getSlogan(),
'color' => $this->theming->getColorPrimary(),
- 'color-text' => $this->util->invertTextColor($this->theming->getColorPrimary()) ? '#000000' : '#FFFFFF',
+ 'color-text' => $this->theming->getTextColorPrimary(),
'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()),
'background' => $backgroundLogo === 'backgroundColor' ?
$this->theming->getColorPrimary() :
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 6b166d897b0..f1a914995d6 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -231,13 +231,8 @@ class ThemingDefaults extends \OC_Defaults {
$variables['image-login-plain'] = 'false';
if ($this->config->getAppValue('theming', 'color', null) !== null) {
- if ($this->util->invertTextColor($this->getColorPrimary())) {
- $colorPrimaryText = '#000000';
- } else {
- $colorPrimaryText = '#ffffff';
- }
$variables['color-primary'] = $this->getColorPrimary();
- $variables['color-primary-text'] = $colorPrimaryText;
+ $variables['color-primary-text'] = $this->getTextColorPrimary();
$variables['color-primary-element'] = $this->util->elementColor($this->getColorPrimary());
}
@@ -321,4 +316,13 @@ class ThemingDefaults extends \OC_Defaults {
return $returnValue;
}
+
+ /**
+ * Color of text in the header and primary buttons
+ *
+ * @return string
+ */
+ public function getTextColorPrimary() {
+ return $this->util->invertTextColor($this->getColorPrimary()) ? '#000000' : '#ffffff';
+ }
}
diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php
index 8ab7f6e2c7f..77582064a3e 100644
--- a/apps/theming/tests/CapabilitiesTest.php
+++ b/apps/theming/tests/CapabilitiesTest.php
@@ -61,7 +61,7 @@ class CapabilitiesTest extends TestCase {
public function dataGetCapabilities() {
return [
- ['name', 'url', 'slogan', '#FFFFFF', 'logo', 'background', 'http://absolute/', [
+ ['name', 'url', 'slogan', '#FFFFFF', '#000000', 'logo', 'background', 'http://absolute/', [
'name' => 'name',
'url' => 'url',
'slogan' => 'slogan',
@@ -70,21 +70,21 @@ class CapabilitiesTest extends TestCase {
'logo' => 'http://absolute/logo',
'background' => 'http://absolute/background',
]],
- ['name1', 'url2', 'slogan3', '#01e4a0', 'logo5', 'background6', 'http://localhost/', [
+ ['name1', 'url2', 'slogan3', '#01e4a0', '#ffffff', 'logo5', 'background6', 'http://localhost/', [
'name' => 'name1',
'url' => 'url2',
'slogan' => 'slogan3',
'color' => '#01e4a0',
- 'color-text' => '#FFFFFF',
+ 'color-text' => '#ffffff',
'logo' => 'http://localhost/logo5',
'background' => 'http://localhost/background6',
]],
- ['name1', 'url2', 'slogan3', '#000000', 'logo5', 'backgroundColor', 'http://localhost/', [
+ ['name1', 'url2', 'slogan3', '#000000', '#ffffff', 'logo5', 'backgroundColor', 'http://localhost/', [
'name' => 'name1',
'url' => 'url2',
'slogan' => 'slogan3',
'color' => '#000000',
- 'color-text' => '#FFFFFF',
+ 'color-text' => '#ffffff',
'logo' => 'http://localhost/logo5',
'background' => '#000000',
]],
@@ -98,11 +98,12 @@ class CapabilitiesTest extends TestCase {
* @param string $slogan
* @param string $color
* @param string $logo
+ * @param string $textColor
* @param string $background
* @param string $baseUrl
* @param string[] $expected
*/
- public function testGetCapabilities($name, $url, $slogan, $color, $logo, $background, $baseUrl, array $expected) {
+ public function testGetCapabilities($name, $url, $slogan, $color, $textColor, $logo, $background, $baseUrl, array $expected) {
$this->config->expects($this->once())
->method('getAppValue')
->willReturn($background);
@@ -121,6 +122,9 @@ class CapabilitiesTest extends TestCase {
$this->theming->expects($this->once())
->method('getLogo')
->willReturn($logo);
+ $this->theming->expects($this->once())
+ ->method('getTextColorPrimary')
+ ->willReturn($textColor);
if($background !== 'backgroundColor') {
$this->theming->expects($this->once())