diff options
author | Ferdinand Thiessen <rpm@fthiessen.de> | 2022-07-20 19:21:32 +0200 |
---|---|---|
committer | Ferdinand Thiessen <rpm@fthiessen.de> | 2022-07-26 12:19:42 +0200 |
commit | e4c825e58305481c4a13c17d18d33fb1267d9ea1 (patch) | |
tree | 9d15f9b1055169c256facbae84a02a9786fe5f08 /apps | |
parent | 7615536977eda7f3bda5c29eaa780a323c97afc7 (diff) | |
download | nextcloud-server-e4c825e58305481c4a13c17d18d33fb1267d9ea1.tar.gz nextcloud-server-e4c825e58305481c4a13c17d18d33fb1267d9ea1.zip |
files: Fix colormode detection for filelist
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')
-rw-r--r-- | apps/files/js/filelist.js | 7 |
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) |