Merge pull request #27854 from nextcloud/fix/27371/fix-dark-theme-public-pages

Fix dark theme on public link shares
pull/27909/head
Joas Schilling 2021-07-09 11:00:53 +07:00 committed by GitHub
commit dfb27470e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 7 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 {

@ -52,10 +52,7 @@
<span class="filename-parts__last">{filename2}</span>
</span>
</td>
<td class="filesize"
style="color:rgb({sizeColor}, {sizeColor}, {sizeColor})">
{size}
</td>
<td class="filesize">{size}</td>
<td class="date">{date}</td>
</tr>
</tbody>