diff options
author | Ferdinand Thiessen <rpm@fthiessen.de> | 2022-07-20 21:11:57 +0200 |
---|---|---|
committer | nextcloud-command <nextcloud-command@users.noreply.github.com> | 2022-07-26 11:54:35 +0000 |
commit | 800f6b350ea9ec504c14761f5c9738493eb1d241 (patch) | |
tree | 90f9fa66883a19d88ce22e1fceaad5e36bb3bc31 /apps/dashboard/src | |
parent | 7615536977eda7f3bda5c29eaa780a323c97afc7 (diff) | |
download | nextcloud-server-800f6b350ea9ec504c14761f5c9738493eb1d241.tar.gz nextcloud-server-800f6b350ea9ec504c14761f5c9738493eb1d241.zip |
dashboard: Fix dark theme detection
When system default color theme is selected for theming,
the enabledThemes array is empty or just contains one entry 'default',
in this case the color theme has to be retrieved from the browser.
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'apps/dashboard/src')
-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') { |