diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-02-03 13:37:28 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-02-07 02:00:40 +0100 |
commit | 2d548e6496e21852097922adeebec2b0e72401d4 (patch) | |
tree | eb9ae332efe2f35b49b249674f0a2088f9b89fa0 /apps/theming/lib/Themes/CommonThemeTrait.php | |
parent | a37fe5b6e39128c44373a7608ea6e5593d4ed0ee (diff) | |
download | nextcloud-server-2d548e6496e21852097922adeebec2b0e72401d4.tar.gz nextcloud-server-2d548e6496e21852097922adeebec2b0e72401d4.zip |
fix(theming): The background is the primary color and must not be double inverted
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/theming/lib/Themes/CommonThemeTrait.php')
-rw-r--r-- | apps/theming/lib/Themes/CommonThemeTrait.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/theming/lib/Themes/CommonThemeTrait.php b/apps/theming/lib/Themes/CommonThemeTrait.php index 42ee6212cee..dd5b25e1a29 100644 --- a/apps/theming/lib/Themes/CommonThemeTrait.php +++ b/apps/theming/lib/Themes/CommonThemeTrait.php @@ -88,13 +88,13 @@ trait CommonThemeTrait { protected function generateGlobalBackgroundVariables(): array { $backgroundDeleted = $this->config->getAppValue(Application::APP_ID, 'backgroundMime', '') === 'backgroundColor'; $hasCustomLogoHeader = $this->util->isLogoThemed(); - $isDefaultPrimaryBright = $this->util->invertTextColor($this->defaultPrimaryColor); + $isPrimaryBright = $this->util->invertTextColor($this->primaryColor); $variables = []; // Default last fallback values $variables['--image-background-default'] = "url('" . $this->themingDefaults->getBackground() . "')"; - $variables['--color-background-plain'] = $this->defaultPrimaryColor; + $variables['--color-background-plain'] = $this->primaryColor; // Register image variables only if custom-defined foreach (ImageManager::SUPPORTED_IMAGE_KEYS as $image) { @@ -108,11 +108,11 @@ trait CommonThemeTrait { // 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->defaultPrimaryColor; + $variables['--color-background-plain'] = $this->primaryColor; $variables['--image-background-plain'] = 'yes'; $variables['--image-background'] = 'no'; // If no background image is set, we need to check against the shown primary colour - $variables['--background-image-invert-if-bright'] = $isDefaultPrimaryBright ? 'invert(100%)' : 'no'; + $variables['--background-image-invert-if-bright'] = $isPrimaryBright ? 'invert(100%)' : 'no'; } if ($hasCustomLogoHeader) { @@ -133,14 +133,14 @@ trait CommonThemeTrait { $adminBackgroundDeleted = $this->config->getAppValue(Application::APP_ID, 'backgroundMime', '') === 'backgroundColor'; $backgroundImage = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background_image', BackgroundService::BACKGROUND_DEFAULT); $currentVersion = (int)$this->config->getUserValue($user->getUID(), Application::APP_ID, 'userCacheBuster', '0'); - $isPrimaryBright = $this->util->invertTextColor($this->themingDefaults->getColorPrimary()); + $isPrimaryBright = $this->util->invertTextColor($this->primaryColor); // The user removed the background if ($backgroundImage === BackgroundService::BACKGROUND_DISABLED) { return [ // Might be defined already by admin theming, needs to be overridden '--image-background' => 'none', - '--color-background-plain' => $this->themingDefaults->getColorPrimary(), + '--color-background-plain' => $this->primaryColor, // If no background image is set, we need to check against the shown primary colour '--background-image-invert-if-bright' => $isPrimaryBright ? 'invert(100%)' : 'no', ]; @@ -151,7 +151,7 @@ trait CommonThemeTrait { $cacheBuster = substr(sha1($user->getUID() . '_' . $currentVersion), 0, 8); return [ '--image-background' => "url('" . $this->urlGenerator->linkToRouteAbsolute('theming.userTheme.getBackground') . "?v=$cacheBuster')", - '--color-background-plain' => $this->themingDefaults->getColorPrimary(), + '--color-background-plain' => $this->primaryColor, ]; } @@ -159,7 +159,7 @@ trait CommonThemeTrait { if ($backgroundImage === BackgroundService::BACKGROUND_DEFAULT && $adminBackgroundDeleted) { return [ // --image-background is not defined in this case - '--color-background-plain' => $this->themingDefaults->getColorPrimary(), + '--color-background-plain' => $this->primaryColor, '--background-image-invert-if-bright' => $isPrimaryBright ? 'invert(100%)' : 'no', ]; } @@ -168,7 +168,7 @@ trait CommonThemeTrait { if (isset(BackgroundService::SHIPPED_BACKGROUNDS[$backgroundImage])) { return [ '--image-background' => "url('" . $this->urlGenerator->linkTo(Application::APP_ID, "img/background/$backgroundImage") . "')", - '--color-background-plain' => $this->themingDefaults->getColorPrimary(), + '--color-background-plain' => $this->primaryColor, '--background-image-invert-if-bright' => BackgroundService::SHIPPED_BACKGROUNDS[$backgroundImage]['theming'] ?? null === BackgroundService::THEMING_MODE_DARK ? 'invert(100%)' : 'no', ]; } |