diff --git a/apps/theming/css/default.css b/apps/theming/css/default.css
index da4814d66ef..1f0a241307b 100644
--- a/apps/theming/css/default.css
+++ b/apps/theming/css/default.css
@@ -57,6 +57,7 @@
--background-invert-if-bright: invert(100%);
--image-main-background: url('/core/img/app-background.jpg');
--color-primary: #00639a;
+ --color-primary-default: #0082c9;
--color-primary-text: #ffffff;
--color-primary-hover: #3282ae;
--color-primary-light: #e5eff4;
diff --git a/apps/theming/css/settings-admin.css b/apps/theming/css/settings-admin.css
index 2b91404ec3b..00d4e2414fa 100644
--- a/apps/theming/css/settings-admin.css
+++ b/apps/theming/css/settings-admin.css
@@ -89,7 +89,7 @@
margin-top: 10px;
margin-bottom: 20px;
cursor: pointer;
- background-color: var(--color-main-background-not-plain, var(--color-primary));
+ 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%)));
}
#theming #theming-preview #theming-preview-logo {
diff --git a/apps/theming/css/settings-admin.scss b/apps/theming/css/settings-admin.scss
index 706bd37f495..f43d3b8c417 100644
--- a/apps/theming/css/settings-admin.scss
+++ b/apps/theming/css/settings-admin.scss
@@ -100,7 +100,7 @@
margin-top: 10px;
margin-bottom: 20px;
cursor: pointer;
- background-color: var(--color-main-background-not-plain, var(--color-primary));
+ 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%)));
#theming-preview-logo {
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index cc23053a9c3..b1fb90e00e0 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -219,23 +219,28 @@ class ThemingDefaults extends \OC_Defaults {
*/
public function getColorPrimary() {
$user = $this->userSession->getUser();
+
+ // admin-defined primary color
$defaultColor = $this->getDefaultColorPrimary();
- $themingBackground = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background');
-
- // if the user is defined and the selected background is not a colour
- if ($user !== null
- && !preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $themingBackground)) {
+
+ // user-defined primary color
+ $themingBackground = '';
+ if (!empty($user)) {
$themingBackground = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background', 'default');
- if ($themingBackground === 'default') {
- return BackgroundService::DEFAULT_COLOR;
- } else if (isset(BackgroundService::SHIPPED_BACKGROUNDS[$themingBackground]['primary_color'])) {
- return BackgroundService::SHIPPED_BACKGROUNDS[$themingBackground]['primary_color'];
- }
- }
- // If the user selected a specific colour
- if (preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $themingBackground)) {
- return $themingBackground;
+ // if the user-selected background is a background reference
+ if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $themingBackground)) {
+ if ($themingBackground === 'default') {
+ return BackgroundService::DEFAULT_COLOR;
+ } else if (isset(BackgroundService::SHIPPED_BACKGROUNDS[$themingBackground]['primary_color'])) {
+ return BackgroundService::SHIPPED_BACKGROUNDS[$themingBackground]['primary_color'];
+ }
+ }
+
+ // If the user selected a specific colour
+ if (preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $themingBackground)) {
+ return $themingBackground;
+ }
}
// If the default color is not valid, return the default background one
@@ -253,7 +258,7 @@ class ThemingDefaults extends \OC_Defaults {
* @return string
*/
public function getDefaultColorPrimary() {
- $color = $this->config->getAppValue(Application::APP_ID, 'color', $this->color);
+ $color = $this->config->getAppValue(Application::APP_ID, 'color');
if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $color)) {
$color = '#0082c9';
}
diff --git a/apps/theming/src/components/BackgroundSettings.vue b/apps/theming/src/components/BackgroundSettings.vue
index aa65a333f0f..3767cebf815 100644
--- a/apps/theming/src/components/BackgroundSettings.vue
+++ b/apps/theming/src/components/BackgroundSettings.vue
@@ -32,6 +32,17 @@
@click="pickFile">
{{ t('theming', 'Pick from Files') }}
+
+
+