mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Add color functions to templates funcMaps
This commit is contained in:
@ -2,6 +2,7 @@ package style
|
||||
|
||||
import (
|
||||
"github.com/gookit/color"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -51,3 +52,12 @@ func FromBasicFg(fg color.Color) TextStyle {
|
||||
func FromBasicBg(bg color.Color) TextStyle {
|
||||
return New().SetBg(NewBasicColor(bg))
|
||||
}
|
||||
|
||||
func TemplateFuncMapAddColors(m template.FuncMap) template.FuncMap {
|
||||
for k, v := range ColorMap {
|
||||
m[k] = v.Foreground.Sprint
|
||||
}
|
||||
m["underline"] = color.OpUnderscore.Sprint
|
||||
m["bold"] = color.OpBold.Sprint
|
||||
return m
|
||||
}
|
||||
|
Reference in New Issue
Block a user