summaryrefslogtreecommitdiffstats
path: root/apps/dashboard/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dashboard/src')
-rw-r--r--apps/dashboard/src/helpers/getBackgroundUrl.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/dashboard/src/helpers/getBackgroundUrl.js b/apps/dashboard/src/helpers/getBackgroundUrl.js
index 194e5e59885..4876fa77e86 100644
--- a/apps/dashboard/src/helpers/getBackgroundUrl.js
+++ b/apps/dashboard/src/helpers/getBackgroundUrl.js
@@ -26,8 +26,10 @@ import { generateUrl } from '@nextcloud/router'
import prefixWithBaseUrl from './prefixWithBaseUrl'
export default (background, time = 0, themingDefaultBackground = '') => {
- const enabledThemes = window.OCA.Theming.enabledThemes
- const isDarkTheme = enabledThemes.join('').indexOf('dark') !== -1
+ const enabledThemes = window.OCA?.Theming?.enabledThemes || []
+ const isDarkTheme = (enabledThemes.length === 0 || enabledThemes[0] === 'default')
+ ? window.matchMedia('(prefers-color-scheme: dark)').matches
+ : enabledThemes.join('').indexOf('dark') !== -1
if (background === 'default') {
if (themingDefaultBackground && themingDefaultBackground !== 'backgroundColor') {