diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php index 6f9892af10e38..ed33f99926214 100644 --- a/apps/theming/lib/ImageManager.php +++ b/apps/theming/lib/ImageManager.php @@ -76,7 +76,7 @@ public function __construct(IConfig $config, $this->tempManager = $tempManager; } - public function getImageUrl(string $key, bool $useSvg = true): string { + public function getImageUrl(string $key, bool $useSvg = true, string $primaryColor = '#0082c9'): string { $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); if ($this->hasImage($key)) { return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => $key ]) . '?v=' . $cacheBusterCounter; @@ -88,7 +88,8 @@ public function getImageUrl(string $key, bool $useSvg = true): string { case 'favicon': return $this->urlGenerator->imagePath('core', 'logo/logo.png') . '?v=' . $cacheBusterCounter; case 'background': - return $this->urlGenerator->imagePath('core', 'background.png') . '?v=' . $cacheBusterCounter; + $primaryColor = ltrim($primaryColor, '#'); + return $this->urlGenerator->imagePath('core', 'background.php') . '?v=' . $cacheBusterCounter . '&color=' . $primaryColor; } return ''; } diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index df444ebe2d234..eae8a9cf10d94 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -199,9 +199,9 @@ public function getCSSVariables(): array { $variables["--image-background-plain"] = 'true'; continue; } else if ($image === 'background') { - $variables['--image-background-size'] = 'cover'; + $variables['--image-background-size'] = !$this->imageManager->hasImage($image) ? '275px, contain' : 'cover'; } - $variables["--image-$image"] = "url('".$this->imageManager->getImageUrl($image)."')"; + $variables["--image-$image"] = "url('".$this->imageManager->getImageUrl($image, true, $this->primaryColor)."')"; } $variables["--image-login-background"] = $variables["--image-background"]; diff --git a/core/css/guest.css b/core/css/guest.css index 4a88674df4fbe..b7d58fb237ccf 100644 --- a/core/css/guest.css +++ b/core/css/guest.css @@ -24,7 +24,7 @@ body { color: var(--color-primary-text); text-align: center; background-color: var(--color-primary); - background-image: var(--image-background, var(--image-background-plain, url('../../../core/img/background.svg'), linear-gradient(40deg, #0082c9 0%, #30b6ff 100%))); + background-image: var(--image-background, url('../img/background.png')), var(--gradient-primary-background);; background-position: 50% 50%; background-repeat: repeat; background-size: var(--image-background-size, 275px, contain); diff --git a/core/img/background.php b/core/img/background.php new file mode 100644 index 0000000000000..dd335de7c4554 --- /dev/null +++ b/core/img/background.php @@ -0,0 +1,4 @@ + + \ No newline at end of file