diff --git a/internal/glance/config-fields.go b/internal/glance/config-fields.go index 22d7276..41bfa5f 100644 --- a/internal/glance/config-fields.go +++ b/internal/glance/config-fields.go @@ -15,6 +15,7 @@ import ( ) var hslColorFieldPattern = regexp.MustCompile(`^(?:hsla?\()?([\d\.]+)(?: |,)+([\d\.]+)%?(?: |,)+([\d\.]+)%?\)?$`) +var inStringPropertyPattern = regexp.MustCompile(`(?m)([a-zA-Z]+)\[(.*?)\]`) const ( hslHueMax = 360 @@ -133,9 +134,30 @@ func (d *durationField) UnmarshalYAML(node *yaml.Node) error { type customIconField struct { URL template.URL + Color string AutoInvert bool } +func (h *customIconField) Elem() template.HTML { + return h.ElemWithClass("") +} + +func (h *customIconField) ElemWithClass(class string) template.HTML { + if h.AutoInvert && h.Color == "" { + class = "flat-icon " + class + } + + if h.Color != "" { + return template.HTML( + `
`, + ) + } + + return template.HTML( + `