Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFerdinand Thiessen <rpm@fthiessen.de>2022-07-20 20:21:32 +0300
committerFerdinand Thiessen <rpm@fthiessen.de>2022-07-26 13:19:42 +0300
commite4c825e58305481c4a13c17d18d33fb1267d9ea1 (patch)
tree9d15f9b1055169c256facbae84a02a9786fe5f08 /apps/files/js
parent7615536977eda7f3bda5c29eaa780a323c97afc7 (diff)
files: Fix colormode detection for filelistfix/files-dark-color-theme
When system default color theme is selected for theming, the `enabledThemes` array is empty or just contains on entry `'default'`, in this case the color theme has to be retrieved from the browser to ensure text like the modified date is readable. This fixes #33298 Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/filelist.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 42afe792142..d745f3368a5 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1787,8 +1787,11 @@
td.append(linkElem);
tr.append(td);
- var enabledThemes = window.OCA?.Theming?.enabledThemes || []
- var isDarkTheme = enabledThemes.join('').indexOf('dark') !== -1
+ const enabledThemes = window.OCA?.Theming?.enabledThemes || []
+ // Check enabled themes, if system default is selected check the browser
+ const isDarkTheme = (enabledThemes.length === 0 || enabledThemes[0] === 'default')
+ ? window.matchMedia('(prefers-color-scheme: dark)').matches
+ : enabledThemes.join('').indexOf('dark') !== -1
try {
var maxContrastHex = window.getComputedStyle(document.documentElement)