修复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)
|
||||||
|
|
|
@ -20,24 +20,24 @@ 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"`
|
||||||
BackgroundSize string `json:"background_size,omitempty"`
|
BackgroundSize string `json:"background_size,omitempty"`
|
||||||
BackgroundRepeat string `json:"background_repeat,omitempty"`
|
BackgroundRepeat string `json:"background_repeat,omitempty"`
|
||||||
BackgroundColor string `json:"background_color,omitempty"`
|
BackgroundColor string `json:"background_color,omitempty"`
|
||||||
BackgroundPreset string `json:"background_preset"`
|
BackgroundPreset string `json:"background_preset"`
|
||||||
BackgroundPositionX string `json:"background_position_x,omitempty"`
|
BackgroundPositionX string `json:"background_position_x,omitempty"`
|
||||||
BackgroundPositionY string `json:"background_position_y"`
|
BackgroundPositionY string `json:"background_position_y"`
|
||||||
BackgroundAttachment string `json:"background_attachment"`
|
BackgroundAttachment string `json:"background_attachment"`
|
||||||
ColorScheme string `json:"color_scheme"`
|
ColorScheme string `json:"color_scheme"`
|
||||||
SidebarTextcolor string `json:"sidebar_textcolor,omitempty"`
|
SidebarTextcolor string `json:"sidebar_textcolor,omitempty"`
|
||||||
HeaderBackgroundColor string `json:"header_background_color,omitempty"`
|
HeaderBackgroundColor string `json:"header_background_color,omitempty"`
|
||||||
HeaderTextcolor string `json:"header_textcolor,omitempty"`
|
HeaderTextcolor string `json:"header_textcolor,omitempty"`
|
||||||
HeaderImagData ImageData `json:"header_image_data,omitempty"`
|
HeaderImagData ImageData `json:"header_image_data,omitempty"`
|
||||||
SidebarsWidgets Sidebars `json:"sidebars_widgets,omitempty"`
|
SidebarsWidgets Sidebars `json:"sidebars_widgets,omitempty"`
|
||||||
ThemeSupport ThemeSupport
|
ThemeSupport ThemeSupport
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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