Skip to content

Commit dfb2747

Browse files
Merge pull request #27854 from nextcloud/fix/27371/fix-dark-theme-public-pages
Fix dark theme on public link shares
2 parents c2f62ee + ede5db1 commit dfb2747

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

apps/accessibility/js/accessibilityoca.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/accessibility/js/accessibilityoca.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/accessibility/lib/AppInfo/Application.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function injectCss(IUserSession $userSession,
7878
$hash = md5(implode('-', $userValues));
7979
$linkToCSS = $urlGenerator->linkToRoute(self::APP_ID . '.accessibility.getCss', ['md5' => $hash]);
8080
\OCP\Util::addHeader('link', ['rel' => 'stylesheet', 'media' => '(prefers-color-scheme: dark)', 'href' => $linkToCSS]);
81+
\OCP\Util::addScript('accessibility', 'accessibilityoca');
8182
}
8283
}
8384
}

apps/accessibility/lib/Service/JSDataService.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function getData() {
6060
}
6161

6262
return [
63+
'checkMedia' => $user === null,
6364
'theme' => $theme,
6465
'highcontrast' => $highcontrast,
6566
];

apps/accessibility/src/accessibilityoca.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
import { loadState } from '@nextcloud/initial-state'
2525

2626
OCA.Accessibility = loadState('accessibility', 'data')
27+
if (OCA.Accessibility.checkMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
28+
// Overwrite the theme for Guests based on the prefers-color-scheme
29+
OCA.Accessibility.theme = 'dark'
30+
}
31+
2732
if (OCA.Accessibility.theme !== false) {
2833
document.body.classList.add(`theme--${OCA.Accessibility.theme}`)
2934
} else {

core/templates/filepicker.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ <h2>{emptytext}</h2>
5252
<span class="filename-parts__last">{filename2}</span>
5353
</span>
5454
</td>
55-
<td class="filesize"
56-
style="color:rgb({sizeColor}, {sizeColor}, {sizeColor})">
57-
{size}
58-
</td>
55+
<td class="filesize">{size}</td>
5956
<td class="date">{date}</td>
6057
</tr>
6158
</tbody>

0 commit comments

Comments
 (0)