From 328fa1819c20540a158dda1abaf12a7816222c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Wed, 24 May 2023 11:40:57 +0200 Subject: [PATCH] fix(theming): fix header primary invert if background disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/theming/lib/Themes/CommonThemeTrait.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/theming/lib/Themes/CommonThemeTrait.php b/apps/theming/lib/Themes/CommonThemeTrait.php index 799d03e34e8df..8f224782a78b4 100644 --- a/apps/theming/lib/Themes/CommonThemeTrait.php +++ b/apps/theming/lib/Themes/CommonThemeTrait.php @@ -87,13 +87,15 @@ protected function generateGlobalBackgroundVariables(): array { $hasCustomLogoHeader = $this->util->isLogoThemed(); $variables = []; + $defaultColorPrimary = $this->themingDefaults->getDefaultColorPrimary(); // If primary as background has been request or if we have a custom primary colour // let's not define the background image if ($backgroundDeleted) { - $variables['--color-background-plain'] = $this->themingDefaults->getColorPrimary(); + $variables['--color-background-plain'] = $defaultColorPrimary; if ($this->themingDefaults->isUserThemingDisabled() || $user === null) { $variables['--image-background-plain'] = 'true'; + $variables['--background-image-invert-if-bright'] = $this->util->invertTextColor($defaultColorPrimary) ? 'invert(100%)' : 'no'; } } @@ -164,6 +166,7 @@ protected function generateUserBackgroundVariables(): array { if ($globalBackgroundDeleted) { return [ '--image-background-plain' => 'true', + '--background-image-invert-if-bright' => $this->util->invertTextColor($this->primaryColor) ? 'invert(100%)' : 'no', ]; } }