github.com/henvic/wedeploycli@v1.7.6-0.20200319005353-3630f582f284/color/template/template.go (about) 1 package template 2 3 import ( 4 "text/template" 5 6 "github.com/henvic/wedeploycli/color" 7 ) 8 9 var templateColorFunctions = template.FuncMap{ 10 "Reset": func() color.Attribute { return color.Reset }, 11 "Bold": func() color.Attribute { return color.Bold }, 12 "Faint": func() color.Attribute { return color.Faint }, 13 "Italic": func() color.Attribute { return color.Italic }, 14 "Underline": func() color.Attribute { return color.Underline }, 15 "BlinkSlow": func() color.Attribute { return color.BlinkSlow }, 16 "BlinkRapid": func() color.Attribute { return color.BlinkRapid }, 17 "ReverseVideo": func() color.Attribute { return color.ReverseVideo }, 18 "Concealed": func() color.Attribute { return color.Concealed }, 19 "CrossedOut": func() color.Attribute { return color.CrossedOut }, 20 "FgBlack": func() color.Attribute { return color.FgBlack }, 21 "FgRed": func() color.Attribute { return color.FgRed }, 22 "FgGreen": func() color.Attribute { return color.FgGreen }, 23 "FgYellow": func() color.Attribute { return color.FgYellow }, 24 "FgBlue": func() color.Attribute { return color.FgBlue }, 25 "FgMagenta": func() color.Attribute { return color.FgMagenta }, 26 "FgCyan": func() color.Attribute { return color.FgCyan }, 27 "FgWhite": func() color.Attribute { return color.FgWhite }, 28 "FgHiBlack": func() color.Attribute { return color.FgHiBlack }, 29 "FgHiRed": func() color.Attribute { return color.FgHiRed }, 30 "FgHiGreen": func() color.Attribute { return color.FgHiGreen }, 31 "FgHiYellow": func() color.Attribute { return color.FgHiYellow }, 32 "FgHiBlue": func() color.Attribute { return color.FgHiBlue }, 33 "FgHiMagenta": func() color.Attribute { return color.FgHiMagenta }, 34 "FgHiCyan": func() color.Attribute { return color.FgHiCyan }, 35 "FgHiWhite": func() color.Attribute { return color.FgHiWhite }, 36 "BgBlack": func() color.Attribute { return color.BgBlack }, 37 "BgRed": func() color.Attribute { return color.BgRed }, 38 "BgGreen": func() color.Attribute { return color.BgGreen }, 39 "BgYellow": func() color.Attribute { return color.BgYellow }, 40 "BgBlue": func() color.Attribute { return color.BgBlue }, 41 "BgMagenta": func() color.Attribute { return color.BgMagenta }, 42 "BgCyan": func() color.Attribute { return color.BgCyan }, 43 "BgWhite": func() color.Attribute { return color.BgWhite }, 44 "BgHiBlack": func() color.Attribute { return color.BgHiBlack }, 45 "BgHiRed": func() color.Attribute { return color.BgHiRed }, 46 "BgHiGreen": func() color.Attribute { return color.BgHiGreen }, 47 "BgHiYellow": func() color.Attribute { return color.BgHiYellow }, 48 "BgHiBlue": func() color.Attribute { return color.BgHiBlue }, 49 "BgHiMagenta": func() color.Attribute { return color.BgHiMagenta }, 50 "BgHiCyan": func() color.Attribute { return color.BgHiCyan }, 51 "BgHiWhite": func() color.Attribute { return color.BgHiWhite }, 52 "color": func(i ...interface{}) string { return color.Format(i...) }, 53 } 54 55 // Functions lists the color functions 56 func Functions() template.FuncMap { 57 return templateColorFunctions 58 } 59 60 // AddToTemplate adds color functions to a template 61 func AddToTemplate(t *template.Template) { 62 t.Funcs(templateColorFunctions) 63 }