修复bug
This commit is contained in:
parent
75c9a47799
commit
ccfe077947
|
@ -44,7 +44,7 @@ func (h *handle) calColorSchemeCss() (r string) {
|
||||||
|
|
||||||
func (h *handle) calSidebarTextColorCss() (r string) {
|
func (h *handle) calSidebarTextColorCss() (r string) {
|
||||||
colors := h.getColorScheme()
|
colors := h.getColorScheme()
|
||||||
if h.IndexHandle.ThemeMods.SidebarTextcolor == colors[4] {
|
if h.IndexHandle.ThemeMods.SidebarTextcolor != "" && h.IndexHandle.ThemeMods.SidebarTextcolor == colors[4] {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
linkColorRgb := Hex2RgbUint8(h.IndexHandle.ThemeMods.SidebarTextcolor)
|
linkColorRgb := Hex2RgbUint8(h.IndexHandle.ThemeMods.SidebarTextcolor)
|
||||||
|
@ -58,7 +58,7 @@ func (h *handle) calSidebarTextColorCss() (r string) {
|
||||||
|
|
||||||
func (h *handle) calHeaderBackgroundColorCss() (r string) {
|
func (h *handle) calHeaderBackgroundColorCss() (r string) {
|
||||||
colors := h.getColorScheme()
|
colors := h.getColorScheme()
|
||||||
if h.IndexHandle.ThemeMods.HeaderBackgroundColor == colors[1] {
|
if h.IndexHandle.ThemeMods.HeaderBackgroundColor != "" && h.IndexHandle.ThemeMods.HeaderBackgroundColor == colors[1] {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
r = fmt.Sprintf(headerBackgroundColorCssTemplate, h.IndexHandle.ThemeMods.HeaderBackgroundColor, h.IndexHandle.ThemeMods.HeaderBackgroundColor)
|
r = fmt.Sprintf(headerBackgroundColorCssTemplate, h.IndexHandle.ThemeMods.HeaderBackgroundColor, h.IndexHandle.ThemeMods.HeaderBackgroundColor)
|
||||||
|
|
|
@ -21,7 +21,7 @@ func SetTemplateFs(fs embed.FS) {
|
||||||
|
|
||||||
type ThemeMods struct {
|
type ThemeMods struct {
|
||||||
CustomCssPostId int `json:"custom_css_post_id,omitempty"`
|
CustomCssPostId int `json:"custom_css_post_id,omitempty"`
|
||||||
NavMenuLocations any `json:"nav_menu_locations,omitempty"`
|
NavMenuLocations map[string]int `json:"nav_menu_locations,omitempty"`
|
||||||
CustomLogo int `json:"custom_logo,omitempty"`
|
CustomLogo int `json:"custom_logo,omitempty"`
|
||||||
HeaderImage string `json:"header_image,omitempty"`
|
HeaderImage string `json:"header_image,omitempty"`
|
||||||
BackgroundImage string `json:"background_image,omitempty"`
|
BackgroundImage string `json:"background_image,omitempty"`
|
||||||
|
@ -121,10 +121,8 @@ func GetThemeMods(theme string) (r ThemeMods, err error) {
|
||||||
if !ok || mods == "" {
|
if !ok || mods == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//这里在的err可以不用处理,因为php的默认值和有设置过的类型可能不一样,直接按有设置的类型处理就行
|
||||||
r, err = phphelper.UnPHPSerialize[ThemeMods](mods)
|
r, err = phphelper.UnPHPSerialize[ThemeMods](mods)
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
r.setThemeSupport(theme)
|
r.setThemeSupport(theme)
|
||||||
themeModes.Store(theme, r)
|
themeModes.Store(theme, r)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user