Skip to content

Commit

Permalink
files: Fix colormode detection for filelist
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
susnux committed Jul 20, 2022
1 parent de08b53 commit 1bec397
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 && (enabledThemes.length > 1 || enabledThemes[0] != 'default')
? enabledThemes.join('').indexOf('dark') !== -1
: window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches

try {
var maxContrastHex = window.getComputedStyle(document.documentElement)
Expand Down

0 comments on commit 1bec397

Please sign in to comment.