fix(gpt-runner-web): optimize default theme

This commit is contained in:
JinmingYang
2023-07-10 18:37:59 +08:00
parent ee74d92437
commit c3ee988db1

View File

@@ -1,3 +1,4 @@
import { getGlobalConfig } from '../../helpers/global-config'
import { gptrLightTheme } from './gptr-light.theme'
import { gptrDarkTheme } from './gptr-dark.theme'
import { jetbrainsDarkTheme } from './jetbrains-dark.theme'
@@ -17,6 +18,11 @@ export const themeMap = {
jetbrainsLight: jetbrainsLightTheme,
} as const
if (getGlobalConfig().defaultTheme !== 'default') {
const defaultTheme = themeMap[getGlobalConfig().defaultTheme] || themeMap.default
;(themeMap as any).default = defaultTheme
}
export function isDarkTheme(themeName: ThemeName) {
const darkThemes: ThemeName[] = ['default', 'gptrDark', 'vscodeDynamic', 'vscodeDark', 'jetbrainsDark']
return darkThemes.includes(themeName)