WithColor sets the color function for the field. The function should transform a string value by wrapping it in ANSI escape codes. The color function will not be used if the table was initialized in non-terminal mode. The color function will be called before truncation and padding.
(fn func(string) string)
| 44 | // it in ANSI escape codes. The color function will not be used if the table was initialized in non-terminal mode. |
| 45 | // The color function will be called before truncation and padding. |
| 46 | func WithColor(fn func(string) string) fieldOption { |
| 47 | return func(f *tableField) { |
| 48 | f.colorFunc = fn |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // New initializes a table printer with terminal mode and terminal width. When terminal mode is enabled, the |
| 53 | // output will be human-readable, column-formatted to fit available width, and rendered with color support. |
no outgoing calls
searching dependent graphs…