]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix default theming variables 35256/head
authorJohn Molakvoæ <skjnldsv@protonmail.com>
Fri, 18 Nov 2022 14:29:54 +0000 (15:29 +0100)
committerJohn Molakvoæ <skjnldsv@protonmail.com>
Fri, 18 Nov 2022 16:06:26 +0000 (17:06 +0100)
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
apps/theming/css/default.css
apps/theming/css/settings-admin.css
apps/theming/css/settings-admin.scss
apps/theming/lib/Themes/CommonThemeTrait.php
apps/theming/lib/Themes/DarkHighContrastTheme.php
apps/theming/lib/Themes/DefaultTheme.php
apps/theming/lib/Themes/HighContrastTheme.php
apps/theming/lib/ThemingDefaults.php
apps/theming/tests/ThemingDefaultsTest.php
core/css/guest.css

index 3bc1fd974cc5a62413a55c376e805c7ea88ce075..0d3f3402fce87cbbee8b2ebe087b46647390a1f2 100644 (file)
@@ -55,6 +55,7 @@
   --background-invert-if-bright: invert(100%);
   --background-image-invert-if-bright: no;
   --image-background: url('/core/img/app-background.jpg');
+  --image-background-default: url('/core/img/app-background.jpg');
   --color-background-plain: #0082c9;
   --primary-invert-if-bright: no;
   --color-primary: #00639a;
@@ -66,6 +67,7 @@
   --color-primary-light-hover: #dbe4e9;
   --color-primary-text-dark: #ededed;
   --color-primary-element: #00639a;
+  --color-primary-element-default-hover: #329bd3;
   --color-primary-element-text: #ffffff;
   --color-primary-element-hover: #3282ae;
   --color-primary-element-light: #e5eff4;
index 283d76e4305f39c3a56816933f14e5ad5a03c35d..ac3b46d467298d1f27731f2afe3df2a0453fca56 100644 (file)
@@ -98,7 +98,7 @@
   margin-bottom: 20px;
   cursor: pointer;
   background-color: var(--color-primary-default);
-  background-image: var(--image-background, var(--image-background-plain, url("../../../core/img/app-background.jpg"), linear-gradient(40deg, #0082c9 0%, #30b6ff 100%)));
+  background-image: var(--image-background-default, var(--image-background-plain, url("../../../core/img/app-background.jpg"), linear-gradient(40deg, #0082c9 0%, #30b6ff 100%)));
 }
 #theming #theming-preview #theming-preview-logo {
   cursor: pointer;
index 60d9a823a0bd674b743f22ca5bc4c9fbf92b0f15..cbe1e2c3b5fcf706d0f3d65e62b3826bce39c10a 100644 (file)
         margin-bottom: 20px;
         cursor: pointer;
         background-color: var(--color-primary-default);
-        background-image: var(--image-background, var(--image-background-plain, url('../../../core/img/app-background.jpg'), linear-gradient(40deg, #0082c9 0%, #30b6ff 100%)));
+        background-image: var(--image-background-default, var(--image-background-plain, url('../../../core/img/app-background.jpg'), linear-gradient(40deg, #0082c9 0%, #30b6ff 100%)));
 
         #theming-preview-logo {
             cursor: pointer;
index f344ef08c02a97458fb2084fc5a6409b9ea83228..360c335fc7d25ed981bdf7afb4b3e3e058ebaf1b 100644 (file)
@@ -40,6 +40,7 @@ trait CommonThemeTrait {
        protected function generatePrimaryVariables(string $colorMainBackground, string $colorMainText): array {
                $colorPrimaryLight = $this->util->mix($this->primaryColor, $colorMainBackground, -80);
                $colorPrimaryElement = $this->util->elementColor($this->primaryColor);
+               $colorPrimaryElementDefault = $this->util->elementColor($this->defaultPrimaryColor);
                $colorPrimaryElementLight = $this->util->mix($colorPrimaryElement, $colorMainBackground, -80);
 
                // primary related colours
@@ -64,6 +65,7 @@ trait CommonThemeTrait {
 
                        // used for buttons, inputs...
                        '--color-primary-element' => $colorPrimaryElement,
+                       '--color-primary-element-default-hover' => $this->util->mix($colorPrimaryElementDefault, $colorMainBackground, 60),
                        '--color-primary-element-text' => $this->util->invertTextColor($colorPrimaryElement) ? '#000000' : '#ffffff',
                        '--color-primary-element-hover' => $this->util->mix($colorPrimaryElement, $colorMainBackground, 60),
                        '--color-primary-element-light' => $colorPrimaryElementLight,
@@ -80,6 +82,7 @@ trait CommonThemeTrait {
         * Generate admin theming background-related variables
         */
        protected function generateGlobalBackgroundVariables(): array {
+               $user = $this->userSession->getUser();
                $backgroundDeleted = $this->config->getAppValue(Application::APP_ID, 'backgroundMime', '') === 'backgroundColor';
                $hasCustomLogoHeader = $this->util->isLogoThemed();
 
@@ -87,9 +90,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 && $this->themingDefaults->isUserThemingDisabled()) {
-                       $variables['--image-background-plain'] = 'true';
+               if ($backgroundDeleted) {
                        $variables['--color-background-plain'] = $this->themingDefaults->getColorPrimary();
+                       if ($this->themingDefaults->isUserThemingDisabled() || $user === null) {
+                               $variables['--image-background-plain'] = 'true';
+                       }
                }
 
                // Register image variables only if custom-defined
@@ -99,9 +104,11 @@ trait CommonThemeTrait {
                                if ($image === 'background') {
                                        // If background deleted is set, ignoring variable
                                        if ($backgroundDeleted) {
+                                               $variables['--image-background-default'] = 'no';
                                                continue;
                                        }
                                        $variables['--image-background-size'] = 'cover';
+                                       $variables['--image-background-default'] = "url('" . $imageUrl . "')";
                                }
                                $variables["--image-$image"] = "url('" . $imageUrl . "')";
                        }
index 7b82136a56a48b364a99a8b870d15f74184439e5..5636dacf1d957b389022b9d6a8c837842c113358 100644 (file)
@@ -104,6 +104,12 @@ class DarkHighContrastTheme extends DarkTheme implements ITheme {
                        .menutoggle {
                                opacity: 1 !important;
                        }
+                       #app-navigation {
+                               border-right: 1px solid var(--color-border);
+                       }
+                       div.crumb {
+                               filter: brightness(150%);
+                       }
                ";
        }
 }
index bb24bb4566bc873f7683aeaa33b65e77c98282d5..94b71eb9d12a862bb2dcffcf768a5f55f53041fc 100644 (file)
@@ -193,6 +193,7 @@ class DefaultTheme implements ITheme {
 
                        // Default last fallback values
                        '--image-background' => "url('" . $this->urlGenerator->imagePath('core', 'app-background.jpg') . "')",
+                       '--image-background-default' => "url('" . $this->urlGenerator->imagePath('core', 'app-background.jpg') . "')",
                        '--color-background-plain' => $this->defaultPrimaryColor,
                ];
 
index 1ae848c866f3e79f2ce435a308f84cac9f7c94ab..4bb77b8c961bf6cb9b78cc6347149a4c257e90c7 100644 (file)
@@ -104,6 +104,9 @@ class HighContrastTheme extends DefaultTheme implements ITheme {
                        .menutoggle {
                                opacity: 1 !important;
                        }
+                       #app-navigation {
+                               border-right: 1px solid var(--color-border);
+                       }
                ";
        }
 }
index eee44e81fdaba19ecea7d09eb254ab875ca7145f..926cd60f5d4ef9e52ef6bb76a638298038e34e69 100644 (file)
@@ -477,7 +477,7 @@ class ThemingDefaults extends \OC_Defaults {
                                $returnValue = $this->getSlogan();
                                break;
                        case 'color':
-                               $returnValue = $this->getColorPrimary();
+                               $returnValue = $this->getDefaultColorPrimary();
                                break;
                        case 'logo':
                        case 'logoheader':
index d89406701376b0354b8b77c21a150d5378ebc0f8..117f207137dd752d12d9ac1f6717bfe38058e4d0 100644 (file)
@@ -623,16 +623,14 @@ class ThemingDefaultsTest extends TestCase {
                        ->method('deleteAppValue')
                        ->with('theming', 'color');
                $this->config
-                       ->expects($this->exactly(3))
+                       ->expects($this->exactly(2))
                        ->method('getAppValue')
                        ->withConsecutive(
                                ['theming', 'cachebuster', '0'],
                                ['theming', 'color', null],
-                               ['theming', 'disable-user-theming', 'no'],
                        )->willReturnOnConsecutiveCalls(
                                '15',
                                $this->defaults->getColorPrimary(),
-                               'no',
                        );
                $this->config
                        ->expects($this->once())
index c0a24e0d70c167b09ad28eb4026b0470245eaff0..7baa6017a5559e2951c524d5bea081a8d309cdf6 100644 (file)
@@ -23,8 +23,8 @@ body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
        color: var(--color-text);
        text-align: center;
-       background-color: var(--color-main-background-not-plain, var(--color-primary));
-       background-image: var(--image-background, var(--image-background-plain, url('../../../core/img/app-background.jpg'), linear-gradient(40deg, #0082c9 0%, #30b6ff 100%)));
+       background-color: var(--color-primary-default, var(--color-primary));
+       background-image: var(--image-background-plain, var(--image-background, url('../../../core/img/app-background.jpg'), linear-gradient(40deg, #0082c9 0%, #30b6ff 100%)));
     background-attachment: fixed;
        min-height: 100%; /* fix sticky footer */
        height: auto;