diff options
author | Louis <6653109+artonge@users.noreply.github.com> | 2022-07-27 11:29:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 11:29:30 +0200 |
commit | 5edab673a7b39dd552b344c5de25faa5ac56a5ac (patch) | |
tree | 0650a2de4428bd7af55e8f2cff61e0c38c66228e /apps | |
parent | 5a236762b8e6b5f09a0c65f5840416bbad2d159a (diff) | |
parent | 800f6b350ea9ec504c14761f5c9738493eb1d241 (diff) | |
download | nextcloud-server-5edab673a7b39dd552b344c5de25faa5ac56a5ac.tar.gz nextcloud-server-5edab673a7b39dd552b344c5de25faa5ac56a5ac.zip |
Merge pull request #33300 from nextcloud/fix/dashboard-dark-color-theme
dashboard: Fix dark theme detection
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dashboard/src/helpers/getBackgroundUrl.js | 6 |
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') { |