diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-12-08 12:16:05 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-12-11 14:33:54 +0100 |
commit | cce4c285dbfd6957f50112b234b3545ebcceac54 (patch) | |
tree | 2c4644b6b9ffb46b74547305323307f33c0e8eec /apps | |
parent | ef2b0969dd022ed900d01a7567c52635773d6509 (diff) | |
download | nextcloud-server-cce4c285dbfd6957f50112b234b3545ebcceac54.tar.gz nextcloud-server-cce4c285dbfd6957f50112b234b3545ebcceac54.zip |
Fix email buttons for white theme
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/theming/lib/Capabilities.php | 2 | ||||
-rw-r--r-- | apps/theming/lib/ThemingDefaults.php | 16 | ||||
-rw-r--r-- | apps/theming/tests/CapabilitiesTest.php | 16 |
3 files changed, 21 insertions, 13 deletions
diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php index b43779a27b5..1b6bb8927be 100644 --- a/apps/theming/lib/Capabilities.php +++ b/apps/theming/lib/Capabilities.php @@ -75,7 +75,7 @@ class Capabilities implements IPublicCapability { 'url' => $this->theming->getBaseUrl(), 'slogan' => $this->theming->getSlogan(), 'color' => $color, - 'color-text' => $this->util->invertTextColor($color) ? '#000000' : '#FFFFFF', + 'color-text' => $this->theming->getTextColorPrimary(), 'color-element' => $this->util->elementColor($color), 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), 'background' => $backgroundLogo === 'backgroundColor' ? diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index eb1051b13c8..fa43dd50ccd 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -256,13 +256,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()); } @@ -378,4 +373,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 17fc253fa4f..c760c896425 100644 --- a/apps/theming/tests/CapabilitiesTest.php +++ b/apps/theming/tests/CapabilitiesTest.php @@ -65,7 +65,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', @@ -75,22 +75,22 @@ 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', 'color-element' => '#01e4a0', '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', 'color-element' => '#000000', 'logo' => 'http://localhost/logo5', 'background' => '#000000', @@ -105,11 +105,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); @@ -128,6 +129,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()) |