Skip to content

Commit 1f07d8e

Browse files
committed
fix: Compatibility default value is colored or light before v1.5.1
1 parent f4368f5 commit 1f07d8e

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

ui/src/components/Header/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const Header: FC = () => {
8585
let themeMode = 'light';
8686
const { theme, theme_config } = themeSettingStore((_) => _);
8787
if (theme_config?.[theme]?.navbar_style) {
88+
// const color = theme_config[theme].navbar_style.startsWith('#')
8889
themeMode = isLight(theme_config[theme].navbar_style) ? 'light' : 'dark';
8990
console.log('isLightTheme', themeMode);
9091
navbarStyle = `theme-${themeMode}`;

ui/src/pages/Admin/Themes/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ const Index: FC = () => {
166166
const themeConfig = setting.theme_config[themeName];
167167
const formMeta = { ...formData };
168168
formMeta.themes.value = themeName;
169-
formMeta.navbar_style.value = themeConfig?.navbar_style;
169+
formMeta.navbar_style.value = themeConfig?.navbar_style.startsWith('#')
170+
? themeConfig?.navbar_style
171+
: DEFAULT_THEME_COLOR;
170172
formMeta.primary_color.value = themeConfig?.primary_color;
171173
formData.color_scheme.value = setting?.color_scheme || 'system';
172174
setFormData({ ...formMeta });

ui/src/stores/themeSetting.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ const store = create<IType>((set) => ({
4242
},
4343
update: (params) =>
4444
set((state) => {
45+
// Compatibility default value is colored or light before v1.5.1
46+
if (!params.theme_config.default.navbar_style.startsWith('#')) {
47+
params.theme_config.default.navbar_style = DEFAULT_THEME_COLOR;
48+
}
4549
return {
4650
...state,
4751
...params,

0 commit comments

Comments
 (0)