Support format strings in style elements

This commit is contained in:
Christian Muehlhaeuser
2019-12-07 09:27:12 +01:00
parent fd138a00bd
commit 72978312ce
2 changed files with 31 additions and 1 deletions
+5
View File
@@ -67,6 +67,7 @@ type ElementStyle struct {
Theme string `json:"theme"`
Prefix string `json:"prefix"`
Suffix string `json:"suffix"`
Format string `json:"format"`
}
func loadStyle(f string) ([]byte, error) {
@@ -119,6 +120,7 @@ func cascadeStyle(parent ElementStyle, child ElementStyle, onlyColors bool) Elem
s.Blink = parent.Blink
s.Prefix = parent.Prefix
s.Suffix = parent.Suffix
s.Format = parent.Format
}
if child.Color != nil {
@@ -166,6 +168,9 @@ func cascadeStyle(parent ElementStyle, child ElementStyle, onlyColors bool) Elem
if child.Suffix != "" {
s.Suffix = child.Suffix
}
if child.Format != "" {
s.Format = child.Format
}
return s
}