MCPcopy Create free account
hub / github.com/cli/go-gh / WithColor

Function WithColor

pkg/tableprinter/table.go:46–50  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
46func 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.

Callers 3

ExampleTablePrinterFunction · 0.92
ExampleTablePrinterFunction · 0.85

Calls

no outgoing calls

Tested by 3

ExampleTablePrinterFunction · 0.74
ExampleTablePrinterFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…