summaryrefslogtreecommitdiffstats
path: root/apps/accessibility
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2022-05-20 09:06:29 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2022-06-01 05:42:34 +0000
commit06ae90a6391feb96244441e9b9c192187fefb8b4 (patch)
treeadce9b7ab980e38c61477247662873067240ca2c /apps/accessibility
parent722ebedf37345bb4f5c7c6615e70ad1329c4ab66 (diff)
downloadnextcloud-server-06ae90a6391feb96244441e9b9c192187fefb8b4.tar.gz
nextcloud-server-06ae90a6391feb96244441e9b9c192187fefb8b4.zip
Properly calculate primary element based on background luminance
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/accessibility')
-rw-r--r--apps/accessibility/lib/Controller/AccessibilityController.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/accessibility/lib/Controller/AccessibilityController.php b/apps/accessibility/lib/Controller/AccessibilityController.php
index 7a5a82085dc..857aaf8b90f 100644
--- a/apps/accessibility/lib/Controller/AccessibilityController.php
+++ b/apps/accessibility/lib/Controller/AccessibilityController.php
@@ -248,7 +248,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 . ';';
}
@@ -267,4 +267,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';
+ }
}