A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: Compatibility default value is colored or light before v1.5.1
shuai1f07d8eb1585
diff --git a/ui/src/components/Header/index.tsx b/ui/src/components/Header/index.tsxindex 1003220e..bd2296b4 100644--- a/ui/src/components/Header/index.tsx+++ b/ui/src/components/Header/index.tsx@@ -85,6 +85,7 @@ const Header: FC = () => {let themeMode = 'light';const { theme, theme_config } = themeSettingStore((_) => _);if (theme_config?.[theme]?.navbar_style) {+ // const color = theme_config[theme].navbar_style.startsWith('#')themeMode = isLight(theme_config[theme].navbar_style) ? 'light' : 'dark';console.log('isLightTheme', themeMode);navbarStyle = `theme-${themeMode}`;diff --git a/ui/src/pages/Admin/Themes/index.tsx b/ui/src/pages/Admin/Themes/index.tsxindex 63a49055..94eccbca 100644--- a/ui/src/pages/Admin/Themes/index.tsx+++ b/ui/src/pages/Admin/Themes/index.tsx@@ -166,7 +166,9 @@ const Index: FC = () => {const themeConfig = setting.theme_config[themeName];const formMeta = { ...formData };formMeta.themes.value = themeName;- formMeta.navbar_style.value = themeConfig?.navbar_style;+ formMeta.navbar_style.value = themeConfig?.navbar_style.startsWith('#')+ ? themeConfig?.navbar_style+ : DEFAULT_THEME_COLOR;formMeta.primary_color.value = themeConfig?.primary_color;formData.color_scheme.value = setting?.color_scheme || 'system';setFormData({ ...formMeta });diff --git a/ui/src/stores/themeSetting.ts b/ui/src/stores/themeSetting.tsindex 9f6802b8..4b13d818 100644--- a/ui/src/stores/themeSetting.ts+++ b/ui/src/stores/themeSetting.ts@@ -42,6 +42,10 @@ const store = create<IType>((set) => ({},update: (params) =>set((state) => {+ // Compatibility default value is colored or light before v1.5.1+ if (!params.theme_config.default.navbar_style.startsWith('#')) {+ params.theme_config.default.navbar_style = DEFAULT_THEME_COLOR;+ }return {...state,...params,