MCPcopy Index your code
hub / github.com/coder/coder / Color

Function Color

cli/cliui/cliui.go:52–63  ·  view source on GitHub ↗

Color returns a color for the given string.

(s string)

Source from the content-addressed store, hash-verified

50
51// Color returns a color for the given string.
52func Color(s string) termenv.Color {
53 colorOnce.Do(func() {
54 color = termenv.NewOutput(os.Stdout).EnvColorProfile()
55
56 if flag.Lookup("test.v") != nil {
57 // Use a consistent colorless profile in tests so that results
58 // are deterministic.
59 color = termenv.Ascii
60 }
61 })
62 return color.Color(s)
63}
64
65func isTerm() bool {
66 return color != termenv.Ascii

Callers 3

help.goFile · 0.92
cliui.goFile · 0.85
initFunction · 0.85

Calls 1

DoMethod · 0.65

Tested by

no test coverage detected