diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-10-08 10:33:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-08 10:33:22 +0200 |
commit | 7971ba5cc66201830e5b4b141d2478efa2257c75 (patch) | |
tree | eb176aa378f22ce09be1e64742f23304d7e25de3 /apps/theming | |
parent | 75f4b7b1918f56afe18e1ec77d4e1f41ce776383 (diff) | |
parent | 044ab0cbecf46d537e892dfa4efd862182798291 (diff) | |
download | nextcloud-server-7971ba5cc66201830e5b4b141d2478efa2257c75.tar.gz nextcloud-server-7971ba5cc66201830e5b4b141d2478efa2257c75.zip |
Merge pull request #10898 from nextcloud/feature/10684/default-logo-color-theme-colors
Switches the default logo color depending on the primary color
Diffstat (limited to 'apps/theming')
-rw-r--r-- | apps/theming/css/theming.scss | 33 | ||||
-rw-r--r-- | apps/theming/lib/ImageManager.php | 2 | ||||
-rw-r--r-- | apps/theming/lib/ThemingDefaults.php | 5 | ||||
-rw-r--r-- | apps/theming/lib/Util.php | 4 | ||||
-rw-r--r-- | apps/theming/tests/ImageManagerTest.php | 6 | ||||
-rw-r--r-- | apps/theming/tests/ThemingDefaultsTest.php | 4 | ||||
-rw-r--r-- | apps/theming/tests/UtilTest.php | 6 |
7 files changed, 40 insertions, 20 deletions
diff --git a/apps/theming/css/theming.scss b/apps/theming/css/theming.scss index f12ce4d907f..e2cd8fb11ee 100644 --- a/apps/theming/css/theming.scss +++ b/apps/theming/css/theming.scss @@ -7,6 +7,17 @@ @return (0.2126 * $-local-red + 0.7152 * $-local-green + 0.0722 * $-local-blue) / 255; } +$has-custom-logo: variable_exists('theming-logo-mime') and $theming-logo-mime != ''; +$invert: luma($color-primary) > 0.6; + +@if ($has-custom-logo == false) { + @if ($invert) { + $image-logo: url(icon-color-path('logo', 'logo', #000000, 1, true)); + } @else { + $image-logo: url(icon-color-path('logo', 'logo', #ffffff, 1, true)); + } +} + .nc-theming-main-background { background-color: $color-primary; } @@ -19,7 +30,7 @@ color: $color-primary-text; } -@if (luma($color-primary) > 0.6) { +@if ($invert) { #appmenu:not(.inverted) svg { filter: invert(1); } @@ -98,19 +109,29 @@ background-image: url(./img/core/filetypes/folder-drag-accept.svg?v=#{$theming-cachebuster}) !important; } +#theming-preview-logo, +#header .logo { + background-image: $image-logo; +} + /* override styles for login screen in guest.css */ -@if variable_exists('theming-logo-mime') and $theming-logo-mime != '' { +@if ($has-custom-logo) { + // custom logo #theming-preview-logo, #header .logo { - background-image: $image-logo; background-size: contain; } + #body-login #header .logo { margin-bottom: 22px; } } @else { - #theming-preview-logo { - background-image: $image-logo; + // default logo + @if ($invert) { + #theming-preview-logo, + #header .logo { + opacity: .6; + } } } @@ -156,7 +177,7 @@ input.primary, color: $color-primary-text; } -@if (luma($color-primary) > 0.6) { +@if ($invert) { #body-login #submit-wrapper .icon-confirm-white { background-image: url('../../../core/img/actions/confirm.svg'); } diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php index 8c144bfe6ae..d377aa4f222 100644 --- a/apps/theming/lib/ImageManager.php +++ b/apps/theming/lib/ImageManager.php @@ -83,7 +83,7 @@ class ImageManager { case 'logo': case 'logoheader': case 'favicon': - return $this->urlGenerator->imagePath('core', 'logo.png') . '?v=' . $cacheBusterCounter; + return $this->urlGenerator->imagePath('core', 'logo/logo.png') . '?v=' . $cacheBusterCounter; case 'background': return $this->urlGenerator->imagePath('core', 'background.png') . '?v=' . $cacheBusterCounter; } diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 1df7a9f17bb..0573f7b84d7 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -33,7 +33,6 @@ namespace OCA\Theming; - use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; use OCP\Files\NotFoundException; @@ -217,9 +216,9 @@ class ThemingDefaults extends \OC_Defaults { if(!$logo || !$logoExists) { if($useSvg) { - $logo = $this->urlGenerator->imagePath('core', 'logo.svg'); + $logo = $this->urlGenerator->imagePath('core', 'logo/logo.svg'); } else { - $logo = $this->urlGenerator->imagePath('core', 'logo.png'); + $logo = $this->urlGenerator->imagePath('core', 'logo/logo.png'); } return $logo . '?v=' . $cacheBusterCounter; } diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php index b17382334d0..38b876f3610 100644 --- a/apps/theming/lib/Util.php +++ b/apps/theming/lib/Util.php @@ -161,7 +161,7 @@ class Util { } } catch (NotFoundException $e) {} } - return \OC::$SERVERROOT . '/core/img/logo.svg'; + return \OC::$SERVERROOT . '/core/img/logo/logo.svg'; } /** @@ -223,7 +223,7 @@ class Util { /** * Check if a custom theme is set in the server configuration - * + * * @return bool */ public function isAlreadyThemed() { diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index 38f5fb04969..fc9eac7f143 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -144,9 +144,9 @@ class ImageManagerTest extends TestCase { ->willReturnOnConsecutiveCalls(0, false); $this->urlGenerator->expects($this->once()) ->method('imagePath') - ->with('core', 'logo.png') - ->willReturn('logo.png'); - $this->assertEquals('logo.png?v=0', $this->imageManager->getImageUrl('logo')); + ->with('core', 'logo/logo.png') + ->willReturn('logo/logo.png'); + $this->assertEquals('logo/logo.png?v=0', $this->imageManager->getImageUrl('logo')); } public function testGetImageUrlAbsolute() { diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index 5d075709dc5..68435dd148a 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -593,11 +593,11 @@ class ThemingDefaultsTest extends TestCase { } public function testGetLogoDefaultWithSvg() { - $this->getLogoHelper('logo.svg', true); + $this->getLogoHelper('logo/logo.svg', true); } public function testGetLogoDefaultWithoutSvg() { - $this->getLogoHelper('logo.png', false); + $this->getLogoHelper('logo/logo.png', false); } public function testGetLogoCustom() { diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php index 61d1dc48301..d0263e11224 100644 --- a/apps/theming/tests/UtilTest.php +++ b/apps/theming/tests/UtilTest.php @@ -92,7 +92,7 @@ class UtilTest extends TestCase { $invert = $this->util->invertTextColor('aaabbbcccddd123'); $this->assertEquals(false, $invert); } - + public function testInvertTextColorEmpty() { $invert = $this->util->invertTextColor(''); $this->assertEquals(false, $invert); @@ -139,7 +139,7 @@ class UtilTest extends TestCase { public function dataGetAppIcon() { return [ ['user_ldap', \OC_App::getAppPath('user_ldap') . '/img/app.svg'], - ['noapplikethis', \OC::$SERVERROOT . '/core/img/logo.svg'], + ['noapplikethis', \OC::$SERVERROOT . '/core/img/logo/logo.svg'], ['comments', \OC_App::getAppPath('comments') . '/img/comments.svg'], ]; } @@ -174,7 +174,7 @@ class UtilTest extends TestCase { public function dataGetAppImage() { return [ - ['core', 'logo.svg', \OC::$SERVERROOT . '/core/img/logo.svg'], + ['core', 'logo/logo.svg', \OC::$SERVERROOT . '/core/img/logo/logo.svg'], ['files', 'external', \OC::$SERVERROOT . '/apps/files/img/external.svg'], ['files', 'external.svg', \OC::$SERVERROOT . '/apps/files/img/external.svg'], ['noapplikethis', 'foobar.svg', false], |