summaryrefslogtreecommitdiffstats
path: root/apps/theming/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2022-10-13 12:10:56 +0200
committernextcloud-command <nextcloud-command@users.noreply.github.com>2022-10-13 14:31:20 +0000
commit2f8601a27edc1d63b2607539982e8959533f0f40 (patch)
treee7029d712d1167f608b16883030d363a9156f847 /apps/theming/lib
parent9a92fe9b29fb0db0486cebdc869627e0ac3bd4ea (diff)
downloadnextcloud-server-2f8601a27edc1d63b2607539982e8959533f0f40.tar.gz
nextcloud-server-2f8601a27edc1d63b2607539982e8959533f0f40.zip
Adjust testing
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/ThemingDefaults.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index dce6b875db1..9d5183a6504 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -214,10 +214,8 @@ class ThemingDefaults extends \OC_Defaults {
/**
* Color that is used for the header as well as for mail headers
- *
- * @return string
*/
- public function getColorPrimary() {
+ public function getColorPrimary(): string {
$user = $this->userSession->getUser();
// admin-defined primary color
@@ -227,20 +225,20 @@ class ThemingDefaults extends \OC_Defaults {
$themingBackground = '';
if (!empty($user)) {
$themingBackground = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background', '');
-
- // 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 the default background
+ if ($themingBackground === '') {
+ return BackgroundService::DEFAULT_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 (isset(BackgroundService::SHIPPED_BACKGROUNDS[$themingBackground]['primary_color'])) {
+ return BackgroundService::SHIPPED_BACKGROUNDS[$themingBackground]['primary_color'];
+ }
}
// If the default color is not valid, return the default background one
@@ -254,10 +252,8 @@ class ThemingDefaults extends \OC_Defaults {
/**
* Return the default color primary
- *
- * @return string
*/
- public function getDefaultColorPrimary() {
+ public function getDefaultColorPrimary(): string {
$color = $this->config->getAppValue(Application::APP_ID, 'color');
if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $color)) {
$color = '#0082c9';