diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2022-08-19 15:30:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-19 15:30:33 +0200 |
commit | c87f05a5d7a376be3ab1c18c1a481cdfbb2e8512 (patch) | |
tree | 049b7456b4e16ab1e4a481bcd021c224431650aa /apps | |
parent | 71065f5fd5f75b5847795eb0df916c12a7dfc07d (diff) | |
parent | 5e550829c539c4ff13ffef4ca2ece18200faa2ec (diff) | |
download | nextcloud-server-c87f05a5d7a376be3ab1c18c1a481cdfbb2e8512.tar.gz nextcloud-server-c87f05a5d7a376be3ab1c18c1a481cdfbb2e8512.zip |
Merge pull request #33610 from nextcloud/enh/background-blur-vars
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dashboard/src/DashboardApp.vue | 17 | ||||
-rw-r--r-- | apps/theming/css/default.css | 3 | ||||
-rw-r--r-- | apps/theming/lib/Themes/DefaultTheme.php | 12 | ||||
-rw-r--r-- | apps/theming/lib/Themes/HighContrastTheme.php | 3 | ||||
-rw-r--r-- | apps/theming/tests/Themes/DefaultThemeTest.php | 7 |
5 files changed, 30 insertions, 12 deletions
diff --git a/apps/dashboard/src/DashboardApp.vue b/apps/dashboard/src/DashboardApp.vue index c9e73d9d146..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})`, } }, @@ -426,8 +427,6 @@ export default { background-repeat: no-repeat; background-attachment: fixed; background-color: var(--color-primary); - --color-background-translucent: rgba(var(--color-main-background-rgb), 0.8); - --background-blur: blur(10px); > h2 { color: var(--color-primary-text); @@ -453,9 +452,9 @@ export default { width: 320px; max-width: 100%; margin: 16px; - background-color: var(--color-background-translucent); - -webkit-backdrop-filter: var(--background-blur); - backdrop-filter: var(--background-blur); + background-color: var(--color-main-background-blur); + -webkit-backdrop-filter: var(--filter-background-blur); + backdrop-filter: var(--filter-background-blur); border-radius: var(--border-radius-large); #body-user.theme--highcontrast & { @@ -556,9 +555,9 @@ export default { .edit-panels, .statuses ::v-deep .action-item .action-item__menutoggle, .statuses ::v-deep .action-item.action-item--open .action-item__menutoggle { - background-color: var(--color-background-translucent); - -webkit-backdrop-filter: var(--background-blur); - backdrop-filter: var(--background-blur); + background-color: var(--color-main-background-blur); + -webkit-backdrop-filter: var(--filter-background-blur); + backdrop-filter: var(--filter-background-blur); opacity: 1 !important; &:hover, diff --git a/apps/theming/css/default.css b/apps/theming/css/default.css index fb541b7aca9..41a1167a4a5 100644 --- a/apps/theming/css/default.css +++ b/apps/theming/css/default.css @@ -2,6 +2,8 @@ --color-main-background: #ffffff; --color-main-background-rgb: 255,255,255; --color-main-background-translucent: rgba(var(--color-main-background-rgb), .97); + --color-main-background-blur: rgba(var(--color-main-background-rgb), .8); + --filter-background-blur: blur(25px); --gradient-main-background: var(--color-main-background) 0%, var(--color-main-background-translucent) 85%, transparent 100%; --color-background-hover: #f5f5f5; --color-background-dark: #ededed; @@ -59,4 +61,5 @@ --primary-invert-if-bright: no; --background-invert-if-dark: no; --background-invert-if-bright: invert(100%); + --image-main-background: url('/core/img/app-background.jpg'); } diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index d141a5d3241..82bfb000e93 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -97,6 +97,8 @@ class DefaultTheme implements ITheme { '--color-main-background' => $colorMainBackground, '--color-main-background-rgb' => $colorMainBackgroundRGB, '--color-main-background-translucent' => 'rgba(var(--color-main-background-rgb), .97)', + '--color-main-background-blur' => 'rgba(var(--color-main-background-rgb), .8)', + '--filter-background-blur' => 'blur(25px)', // to use like this: background-image: linear-gradient(0, var('--gradient-main-background)); '--gradient-main-background' => 'var(--color-main-background) 0%, var(--color-main-background-translucent) 85%, transparent 100%', @@ -190,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'; @@ -197,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 . "')"; } } diff --git a/apps/theming/lib/Themes/HighContrastTheme.php b/apps/theming/lib/Themes/HighContrastTheme.php index 77239f2076c..4f2f457bd5e 100644 --- a/apps/theming/lib/Themes/HighContrastTheme.php +++ b/apps/theming/lib/Themes/HighContrastTheme.php @@ -59,6 +59,9 @@ class HighContrastTheme extends DefaultTheme implements ITheme { $variables['--color-background-dark'] = $this->util->darken($colorMainBackground, 30); $variables['--color-background-darker'] = $this->util->darken($colorMainBackground, 30); + $variables['--color-main-background-blur'] = $colorMainBackground; + $variables['--filter-background-blur'] = 'none'; + $variables['--color-placeholder-light'] = $this->util->darken($colorMainBackground, 30); $variables['--color-placeholder-dark'] = $this->util->darken($colorMainBackground, 45); diff --git a/apps/theming/tests/Themes/DefaultThemeTest.php b/apps/theming/tests/Themes/DefaultThemeTest.php index 160efdba142..84430360897 100644 --- a/apps/theming/tests/Themes/DefaultThemeTest.php +++ b/apps/theming/tests/Themes/DefaultThemeTest.php @@ -75,6 +75,13 @@ class DefaultThemeTest extends TestCase { return vsprintf($text, $parameters); }); + $this->urlGenerator + ->expects($this->any()) + ->method('imagePath') + ->willReturnCallback(function ($app = 'core', $filename = '') { + return "/$app/img/$filename"; + }); + $this->defaultTheme = new DefaultTheme( $util, $this->themingDefaults, |