Skip to content

Commit 975174a

Browse files
committed
Fix logo invert
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 175ac79 commit 975174a

13 files changed

Lines changed: 61 additions & 50 deletions

File tree

apps/theming/lib/Themes/CommonThemeTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function generatePrimaryVariables(string $colorMainBackground, string
8484
protected function generateGlobalBackgroundVariables(): array {
8585
$user = $this->userSession->getUser();
8686
$backgroundDeleted = $this->config->getAppValue(Application::APP_ID, 'backgroundMime', '') === 'backgroundColor';
87-
$hasCustomLogoHeader = $this->imageManager->hasImage('logo') || $this->imageManager->hasImage('logoheader');
87+
$hasCustomLogoHeader = $this->util->isLogoThemed();
8888

8989
$variables = [];
9090

apps/theming/lib/Util.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,13 @@ class Util {
4141
private IConfig $config;
4242
private IAppManager $appManager;
4343
private IAppData $appData;
44+
private ImageManager $imageManager;
4445

45-
/**
46-
* Util constructor.
47-
*
48-
* @param IConfig $config
49-
* @param IAppManager $appManager
50-
* @param IAppData $appData
51-
*/
52-
public function __construct(IConfig $config, IAppManager $appManager, IAppData $appData) {
46+
public function __construct(IConfig $config, IAppManager $appManager, IAppData $appData, ImageManager $imageManager) {
5347
$this->config = $config;
5448
$this->appManager = $appManager;
5549
$this->appData = $appData;
50+
$this->imageManager = $imageManager;
5651
}
5752

5853
/**
@@ -266,4 +261,9 @@ public function isBackgroundThemed() {
266261
$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', '');
267262
return $backgroundLogo !== '' && $backgroundLogo !== 'backgroundColor';
268263
}
264+
265+
public function isLogoThemed() {
266+
return $this->imageManager->hasImage('logo')
267+
|| $this->imageManager->hasImage('logoheader');
268+
}
269269
}

apps/theming/tests/CapabilitiesTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
namespace OCA\Theming\Tests;
3030

3131
use OCA\Theming\Capabilities;
32+
use OCA\Theming\ImageManager;
3233
use OCA\Theming\ThemingDefaults;
3334
use OCA\Theming\Util;
3435
use OCP\App\IAppManager;
@@ -173,7 +174,7 @@ public function testGetCapabilities($name, $url, $slogan, $color, $textColor, $l
173174
->method('getTextColorPrimary')
174175
->willReturn($textColor);
175176

176-
$util = new Util($this->config, $this->createMock(IAppManager::class), $this->createMock(IAppData::class));
177+
$util = new Util($this->config, $this->createMock(IAppManager::class), $this->createMock(IAppData::class), $this->createMock(ImageManager::class));
177178
$this->util->expects($this->exactly(3))
178179
->method('elementColor')
179180
->with($color)

apps/theming/tests/IconBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected function setUp(): void {
6363
$this->themingDefaults = $this->createMock(ThemingDefaults::class);
6464
$this->appManager = $this->createMock(IAppManager::class);
6565
$this->imageManager = $this->createMock(ImageManager::class);
66-
$this->util = new Util($this->config, $this->appManager, $this->appData);
66+
$this->util = new Util($this->config, $this->appManager, $this->appData, $this->imageManager);
6767
$this->iconBuilder = new IconBuilder($this->themingDefaults, $this->util, $this->imageManager);
6868
}
6969

apps/theming/tests/Themes/DefaultThemeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ protected function setUp(): void {
6666
$util = new Util(
6767
$this->config,
6868
$this->appManager,
69-
$this->createMock(IAppData::class)
69+
$this->createMock(IAppData::class),
70+
$this->imageManager
7071
);
7172

7273
$this->themingDefaults

apps/theming/tests/Themes/DyslexiaFontTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ protected function setUp(): void {
6767

6868
$util = new Util(
6969
$this->config,
70-
$this->createMock(AppManager::class),
71-
$this->createMock(IAppData::class)
70+
$this->appManager,
71+
$this->createMock(IAppData::class),
72+
$this->imageManager
7273
);
7374

7475
$userSession = $this->createMock(IUserSession::class);

apps/theming/tests/UtilTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828
namespace OCA\Theming\Tests;
2929

30+
use OCA\Theming\ImageManager;
3031
use OCA\Theming\Util;
3132
use OCP\App\IAppManager;
3233
use OCP\Files\IAppData;
@@ -46,13 +47,16 @@ class UtilTest extends TestCase {
4647
protected $appData;
4748
/** @var IAppManager */
4849
protected $appManager;
50+
/** @var ImageManager */
51+
protected $imageManager;
4952

5053
protected function setUp(): void {
5154
parent::setUp();
5255
$this->config = $this->createMock(IConfig::class);
5356
$this->appData = $this->createMock(IAppData::class);
5457
$this->appManager = $this->createMock(IAppManager::class);
55-
$this->util = new Util($this->config, $this->appManager, $this->appData);
58+
$this->imageManager = $this->createMock(ImageManager::class);
59+
$this->util = new Util($this->config, $this->appManager, $this->appData, $this->imageManager);
5660
}
5761

5862
public function dataInvertTextColor() {

core/css/header.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/css/header.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/css/header.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@
172172
left: 12px;
173173
top: 1px;
174174
bottom: 1px;
175+
// Invert if not customized
176+
filter: var(--image-logoheader-custom, invert(100%));
175177
}
176178

177179
.header-appname-container {

0 commit comments

Comments
 (0)