diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2022-05-20 10:06:29 +0300 |
---|---|---|
committer | John Molakvoæ (Rebase PR Action) <skjnldsv@users.noreply.github.com> | 2022-05-31 20:27:12 +0300 |
commit | 20efadff5fa0b156c65f9dddc7e72b65d6f6a918 (patch) | |
tree | 287013060545e0f7044bd9a2153352fcb912d1c6 /apps/accessibility | |
parent | 3638e65027afad9f51676ba7bb6feea2ea4a5c88 (diff) |
Properly calculate primary element based on background luminancefix/theming-colours-primary-24
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/accessibility')
-rw-r--r-- | apps/accessibility/lib/Controller/AccessibilityController.php | 16 |
1 files changed, 15 insertions, 1 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'; + } } |