mirror of
https://github.com/nextcloud/server.git
synced 2026-02-23 18:05:02 -05:00
Fix accessibility theme for guests
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
0e90199f1d
commit
2b122fbcf0
5 changed files with 10 additions and 3 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -78,6 +78,7 @@ class Application extends App implements IBootstrap {
|
|||
$hash = md5(implode('-', $userValues));
|
||||
$linkToCSS = $urlGenerator->linkToRoute(self::APP_ID . '.accessibility.getCss', ['md5' => $hash]);
|
||||
\OCP\Util::addHeader('link', ['rel' => 'stylesheet', 'media' => '(prefers-color-scheme: dark)', 'href' => $linkToCSS]);
|
||||
\OCP\Util::addScript('accessibility', 'accessibilityoca');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class JSDataService extends InitialStateProvider {
|
|||
}
|
||||
|
||||
return [
|
||||
'checkMedia' => $user === null,
|
||||
'theme' => $theme,
|
||||
'highcontrast' => $highcontrast,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@
|
|||
import { loadState } from '@nextcloud/initial-state'
|
||||
|
||||
OCA.Accessibility = loadState('accessibility', 'data')
|
||||
if (OCA.Accessibility.checkMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
// Overwrite the theme for Guests based on the prefers-color-scheme
|
||||
OCA.Accessibility.theme = 'dark'
|
||||
}
|
||||
|
||||
if (OCA.Accessibility.theme !== false) {
|
||||
document.body.classList.add(`theme--${OCA.Accessibility.theme}`)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue