MCPcopy Create free account
hub / github.com/Masterminds/glide / Color

Method Color

msg/out.go:23–28  ·  view source on GitHub ↗

Color returns a string in a certain color. The first argument is a string containing the color code or a constant from the table above mapped to a code. The following will print the string "Foo" in yellow: fmt.Print(Color(Yellow, "Foo"))

(code, msg string)

Source from the content-addressed store, hash-verified

21// The following will print the string "Foo" in yellow:
22// fmt.Print(Color(Yellow, "Foo"))
23func (m *Messenger) Color(code, msg string) string {
24 if m.NoColor {
25 return msg
26 }
27 return fmt.Sprintf("\033[%sm%s\033[m", code, msg)
28}

Callers 6

InfoMethod · 0.95
WarnMethod · 0.95
ErrMethod · 0.95
mainFunction · 0.45
ColorFunction · 0.45
installer.goFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected