diff options
Diffstat (limited to 'lib/state')
-rw-r--r-- | lib/state/templates.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/state/templates.go b/lib/state/templates.go index 1e8bad00..f971b62c 100644 --- a/lib/state/templates.go +++ b/lib/state/templates.go @@ -472,3 +472,14 @@ func (d *TemplateData) Style(content, name string) string { style := cfg.GetUserStyle(name) return parse.ApplyStyle(style, content) } + +func (d *TemplateData) StyleSwitch(content string, cases ...models.Case) string { + for _, c := range cases { + if c.Matches(content) { + cfg := config.Ui.ForAccount(d.Account()) + style := cfg.GetUserStyle(c.Value()) + return parse.ApplyStyle(style, content) + } + } + return content +} |