From d9a8edd8e9269aa1189d55c8d13caa05084435f5 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 27 Feb 2023 09:18:16 -0600 Subject: templates: allow inline user styles Allow custom user-defined styles in a styleset. The styles can take any name, and must be under the [user] ini section. All attributes apply to user defined styles. Example: [user] red.fg=red red.bold=true Add a .Style function which accepts the name of a user-defined style and applies it to the string. {{.Style "red" "foo"}} Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- config/ui.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'config/ui.go') diff --git a/config/ui.go b/config/ui.go index b1330ffd..64469643 100644 --- a/config/ui.go +++ b/config/ui.go @@ -629,6 +629,10 @@ func (base *UIConfig) mergeContextual( return base } +func (uiConfig *UIConfig) GetUserStyle(name string) tcell.Style { + return uiConfig.style.UserStyle(name) +} + func (uiConfig *UIConfig) GetStyle(so StyleObject) tcell.Style { return uiConfig.style.Get(so) } -- cgit