Fixing theme-related issues

This commit is contained in:
Physton
2023-06-20 10:00:43 +08:00
parent f8ea3d110a
commit 792ed03a91
3 changed files with 5 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -400,7 +400,9 @@ export default {
common.loadCSS('main.min.css', 'physton-prompt-main', true)
const urlParams = new URLSearchParams(window.location.search);
const theme = urlParams.get("__theme")
let theme = urlParams.get("__theme") || 'dark'
// 如果不是 dark 和 light默认设置为 dark
theme = ['dark', 'light'].includes(theme) ? theme : 'dark'
if (!common.gradioApp().classList.contains(theme)) {
common.gradioApp().classList.add(theme)
}