Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable21] Fix dark theme on public link shares #27896

Merged
merged 2 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/accessibility/js/accessibilityoca.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/accessibility/js/accessibilityoca.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions apps/accessibility/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function injectCss(IUserSession $userSession,
$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');
}
}
}
1 change: 1 addition & 0 deletions apps/accessibility/lib/Service/JSDataService.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function getData() {
}

return [
'checkMedia' => $user === null,
'theme' => $theme,
'highcontrast' => $highcontrast,
];
Expand Down
5 changes: 5 additions & 0 deletions apps/accessibility/src/accessibilityoca.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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 {
Expand Down
5 changes: 1 addition & 4 deletions core/templates/filepicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ <h2>{emptytext}</h2>
<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>
Expand Down