Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2022-06-01 08:39:16 +0300
committerGitHub <noreply@github.com>2022-06-01 08:39:16 +0300
commite7ddf60bab46935a937496c76b8696d6f7931053 (patch)
tree7f4209af8f55d986fc9d456c1511dfe135a0cb1a /apps
parentcdaf80809f31b763d57984545c0ffe65ed7f68d8 (diff)
parent20efadff5fa0b156c65f9dddc7e72b65d6f6a918 (diff)
Merge pull request #32510 from nextcloud/fix/theming-colours-primary-24
Diffstat (limited to 'apps')
-rw-r--r--apps/accessibility/lib/Controller/AccessibilityController.php16
-rw-r--r--apps/theming/lib/ThemingDefaults.php4
2 files changed, 17 insertions, 3 deletions
diff --git a/apps/accessibility/lib/Controller/AccessibilityController.php b/apps/accessibility/lib/Controller/AccessibilityController.php
index b3063937a1b..189ce3d9762 100644
--- a/apps/accessibility/lib/Controller/AccessibilityController.php
+++ b/apps/accessibility/lib/Controller/AccessibilityController.php
@@ -219,7 +219,7 @@ class AccessibilityController extends Controller {
return $this->injectedVariables;
}
$variables = '';
- foreach ($this->defaults->getScssVariables() as $key => $value) {
+ foreach ($this->defaults->getScssVariables(!$this->isDarkThemeEnabled()) as $key => $value) {
$variables .= '$' . $key . ': ' . $value . ';';
}
@@ -238,4 +238,18 @@ class AccessibilityController extends Controller {
}
return $variables;
}
+
+ /**
+ * Return true if the dark theme is enabled for the current user
+ */
+ private function isDarkThemeEnabled(): bool {
+ if (!$this->userSession->isLoggedIn()) {
+ return false;
+ }
+ $user = $this->userSession->getUser();
+ if (!$user) {
+ return false;
+ }
+ return $this->config->getUserValue($user->getUID(), $this->appName, 'theme', false) === 'dark';
+ }
}
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 3d7aaee2064..1001cb78c18 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -315,7 +315,7 @@ class ThemingDefaults extends \OC_Defaults {
/**
* @return array scss variables to overwrite
*/
- public function getScssVariables() {
+ public function getScssVariables(bool $brightBackground = true) {
$cacheBuster = $this->config->getAppValue('theming', 'cachebuster', '0');
$cache = $this->cacheFactory->createDistributed('theming-' . $cacheBuster . '-' . $this->urlGenerator->getBaseUrl());
if ($value = $cache->get('getScssVariables')) {
@@ -339,7 +339,7 @@ class ThemingDefaults extends \OC_Defaults {
if ($this->config->getAppValue('theming', 'color', '') !== '') {
$variables['color-primary'] = $this->getColorPrimary();
$variables['color-primary-text'] = $this->getTextColorPrimary();
- $variables['color-primary-element'] = $this->util->elementColor($this->getColorPrimary());
+ $variables['color-primary-element'] = $this->util->elementColor($this->getColorPrimary(), $brightBackground);
}
if ($this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor') {