Skip to content

Commit 7573cf3

Browse files
committed
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>
1 parent 051518c commit 7573cf3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/files/js/filelist.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,8 +1787,11 @@
17871787
td.append(linkElem);
17881788
tr.append(td);
17891789

1790-
var enabledThemes = window.OCA?.Theming?.enabledThemes || []
1791-
var isDarkTheme = enabledThemes.join('').indexOf('dark') !== -1
1790+
const enabledThemes = window.OCA?.Theming?.enabledThemes || []
1791+
// Check enabled themes, if system default is selected check the browser
1792+
const isDarkTheme = (enabledThemes.length === 0 || enabledThemes[0] === 'default')
1793+
? window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
1794+
: enabledThemes.join('').indexOf('dark') !== -1
17921795

17931796
try {
17941797
var maxContrastHex = window.getComputedStyle(document.documentElement)

0 commit comments

Comments
 (0)