ColorizeJSON returns a colorized version of the input JSON, if the writer supports colors.
(json string)
| 47 | // ColorizeJSON returns a colorized version of the input JSON, if the writer |
| 48 | // supports colors. |
| 49 | func ColorizeJSON(json string) string { |
| 50 | if !shouldUseColors() { |
| 51 | return json |
| 52 | } |
| 53 | |
| 54 | style := (*pretty.Style)(nil) |
| 55 | |
| 56 | return string(pretty.Color([]byte(json), style)) |
| 57 | } |
| 58 | |
| 59 | // Faint returns slightly offset color text if the writer supports it. |
| 60 | func Faint(text string) string { |
no test coverage detected