兼容url格式的主题背景图片

This commit is contained in:
lyswhut
2022-10-29 20:25:24 +08:00
parent 07898cdfd6
commit 2003c5a0c9
6 changed files with 47 additions and 23 deletions
+5 -2
View File
@@ -1,4 +1,4 @@
import { throttle } from '@common/utils'
import { isUrl, throttle } from '@common/utils'
import migrateSetting from '@common/utils/migrateSetting'
import getStore from '@main/utils/store'
import { STORE_NAMES, URL_SCHEME_RXP } from '@common/constants'
@@ -247,7 +247,10 @@ export const getTheme = () => {
if (theme) {
if (theme.config.extInfo['--background-image'] != 'none') {
theme = copyTheme(theme)
theme.config.extInfo['--background-image'] = `url(file:///${joinPath(global.lxDataPath, 'theme_images', theme.config.extInfo['--background-image']).replaceAll('\\', '/')})`
theme.config.extInfo['--background-image'] =
isUrl(theme.config.extInfo['--background-image'])
? `url(${theme.config.extInfo['--background-image']})`
: `url(file:///${joinPath(global.lxDataPath, 'theme_images', theme.config.extInfo['--background-image']).replaceAll('\\', '/')})`
}
} else {
themeId = global.lx.appSetting['theme.id'] == 'auto' && shouldUseDarkColors ? 'black' : 'green'