diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-08-18 15:32:08 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2022-08-19 11:55:10 +0200 |
commit | 57233fd99ac4cdc503c19d1738243271b54c8086 (patch) | |
tree | 7699d435c6fc4e2cb3527380bc5188ce50cb63a3 /apps | |
parent | 49ddaaecbf2345673f871ca0225090b95521b3f4 (diff) | |
download | nextcloud-server-57233fd99ac4cdc503c19d1738243271b54c8086.tar.gz nextcloud-server-57233fd99ac4cdc503c19d1738243271b54c8086.zip |
Expose core background image
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dashboard/src/DashboardApp.vue | 3 | ||||
-rw-r--r-- | apps/theming/lib/Themes/DefaultTheme.php | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/apps/dashboard/src/DashboardApp.vue b/apps/dashboard/src/DashboardApp.vue index b9990566030..a7ec30fdb4d 100644 --- a/apps/dashboard/src/DashboardApp.vue +++ b/apps/dashboard/src/DashboardApp.vue @@ -170,8 +170,9 @@ export default { || this.background.match(/#[0-9A-Fa-f]{6}/g)) { return null } + return { - backgroundImage: `url(${this.backgroundImage})`, + backgroundImage: this.background === 'default' ? 'var(--image-main-background)' : `url(${this.backgroundImage})`, } }, diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index 6fd29132a53..82bfb000e93 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -192,6 +192,8 @@ class DefaultTheme implements ITheme { '--primary-invert-if-bright' => $this->util->invertTextColor($this->primaryColor) ? 'invert(100%)' : 'no', '--background-invert-if-dark' => 'no', '--background-invert-if-bright' => 'invert(100%)', + + '--image-main-background' => "url('" . $this->urlGenerator->imagePath('core', 'app-background.jpg') . "')", ]; $backgroundDeleted = $this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor'; @@ -199,19 +201,21 @@ class DefaultTheme implements ITheme { // let's not define the background image if ($backgroundDeleted || $hasCustomPrimaryColour) { $variables["--image-background-plain"] = 'true'; - } + } // Register image variables only if custom-defined foreach(['logo', 'logoheader', 'favicon', 'background'] as $image) { if ($this->imageManager->hasImage($image)) { + $imageUrl = $this->imageManager->getImageUrl($image); if ($image === 'background') { // If background deleted is set, ignoring variable if ($backgroundDeleted) { continue; - } + } $variables['--image-background-size'] = 'cover'; + $variables['--image-main-background'] = "url('" . $imageUrl . "')"; } - $variables["--image-$image"] = "url('".$this->imageManager->getImageUrl($image)."')"; + $variables["--image-$image"] = "url('" . $imageUrl . "')"; } } |