From e8da32fca8304310d51776f1d71e7da3a0b03248 Mon Sep 17 00:00:00 2001 From: Alexei Anoshenko <2277098+anoshenko@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:50:58 +0200 Subject: [PATCH] Bug fixing --- viewStyle.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/viewStyle.go b/viewStyle.go index 690e346..0671a4f 100644 --- a/viewStyle.go +++ b/viewStyle.go @@ -109,8 +109,9 @@ func split4Values(text string) []string { } func backgroundCSS(properties Properties, session Session) string { + if value := properties.getRaw(Background); value != nil { - if backgrounds, ok := value.([]BackgroundElement); ok { + if backgrounds, ok := value.([]BackgroundElement); ok && len(backgrounds) > 0 { buffer := allocStringBuilder() defer freeStringBuilder(buffer) @@ -124,6 +125,11 @@ func backgroundCSS(properties Properties, session Session) string { } if buffer.Len() > 0 { + backgroundColor, _ := colorProperty(properties, BackgroundColor, session) + if backgroundColor != 0 { + buffer.WriteRune(' ') + buffer.WriteString(backgroundColor.cssString()) + } return buffer.String() } } @@ -199,7 +205,7 @@ func (style *viewStyle) cssViewStyle(builder cssBuilder, session Session) { cssTag string } colorProperties := []propertyCss{ - {BackgroundColor, string(BackgroundColor)}, + //{BackgroundColor, string(BackgroundColor)}, {TextColor, "color"}, {TextLineColor, "text-decoration-color"}, {CaretColor, string(CaretColor)}, @@ -217,6 +223,11 @@ func (style *viewStyle) cssViewStyle(builder cssBuilder, session Session) { if background := backgroundCSS(style, session); background != "" { builder.add("background", background) + } else { + backgroundColor, _ := colorProperty(style, BackgroundColor, session) + if backgroundColor != 0 { + builder.add("background-color", backgroundColor.cssString()) + } } if font, ok := stringProperty(style, FontName, session); ok && font != "" {