()
| 29 | } |
| 30 | |
| 31 | func InitColorSupport() { |
| 32 | if colorsEnabled() { |
| 33 | colorize = func(message string, textColor color.Attribute, bold int) string { |
| 34 | colorPrinter := color.New(textColor) |
| 35 | if bold == 1 { |
| 36 | colorPrinter = colorPrinter.Add(color.Bold) |
| 37 | } |
| 38 | f := colorPrinter.SprintFunc() |
| 39 | return f(message) |
| 40 | } |
| 41 | } else { |
| 42 | colorize = func(message string, _ color.Attribute, _ int) string { |
| 43 | return message |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | func colorsEnabled() bool { |
| 49 | if os.Getenv("CF_COLOR") == "true" { |
no test coverage detected