From cb3d043c9069ce16b873b6305f714044304f658e Mon Sep 17 00:00:00 2001 From: xing Date: Sun, 19 Feb 2023 23:11:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/theme/twentyfifteen/colorschemecss.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/theme/twentyfifteen/colorschemecss.go b/internal/theme/twentyfifteen/colorschemecss.go index a9b97eb..5b3057c 100644 --- a/internal/theme/twentyfifteen/colorschemecss.go +++ b/internal/theme/twentyfifteen/colorschemecss.go @@ -11,6 +11,9 @@ func (h *handle) colorSchemeCss() string { s := slice.Filter([]string{h.calColorSchemeCss(), h.calSidebarTextColorCss(), h.calHeaderBackgroundColorCss()}, func(s string) bool { return s != "" }) + if len(s) < 1 { + return "" + } return fmt.Sprintf(``, "twentyfifteen-style", "", strings.Join(s, "\n")) } func (h *handle) calColorSchemeCss() (r string) { @@ -44,7 +47,7 @@ func (h *handle) calColorSchemeCss() (r string) { func (h *handle) calSidebarTextColorCss() (r string) { colors := h.getColorScheme() - if h.IndexHandle.ThemeMods.SidebarTextcolor != "" && h.IndexHandle.ThemeMods.SidebarTextcolor == colors[4] { + if h.IndexHandle.ThemeMods.SidebarTextcolor == "" || h.IndexHandle.ThemeMods.SidebarTextcolor == colors[4] { return } linkColorRgb := Hex2RgbUint8(h.IndexHandle.ThemeMods.SidebarTextcolor) @@ -58,7 +61,7 @@ func (h *handle) calSidebarTextColorCss() (r string) { func (h *handle) calHeaderBackgroundColorCss() (r string) { colors := h.getColorScheme() - if h.IndexHandle.ThemeMods.HeaderBackgroundColor != "" && h.IndexHandle.ThemeMods.HeaderBackgroundColor == colors[1] { + if h.IndexHandle.ThemeMods.HeaderBackgroundColor == "" || h.IndexHandle.ThemeMods.HeaderBackgroundColor == colors[1] { return } r = fmt.Sprintf(headerBackgroundColorCssTemplate, h.IndexHandle.ThemeMods.HeaderBackgroundColor, h.IndexHandle.ThemeMods.HeaderBackgroundColor)