MCPcopy
hub / github.com/cli/cli / ColorFromString

Method ColorFromString

pkg/iostreams/color.go:236–263  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

234}
235
236func (c *ColorScheme) ColorFromString(s string) func(string) string {
237 s = strings.ToLower(s)
238 var fn func(string) string
239 switch s {
240 case "bold":
241 fn = c.Bold
242 case "red":
243 fn = c.Red
244 case "yellow":
245 fn = c.Yellow
246 case "green":
247 fn = c.Green
248 case "gray":
249 fn = c.Muted
250 case "magenta":
251 fn = c.Magenta
252 case "cyan":
253 fn = c.Cyan
254 case "blue":
255 fn = c.Blue
256 default:
257 fn = func(s string) string {
258 return s
259 }
260 }
261
262 return fn
263}
264
265// Label stylizes text based on label's RGB hex color.
266func (c *ColorScheme) Label(hex string, x string) string {

Callers 12

printSessionFunction · 0.80
listRunFunction · 0.80
printResultsFunction · 0.80
displayIssueResultsFunction · 0.80
printLinkedBranchesFunction · 0.80
issueStateTitleWithColorFunction · 0.80
PrintIssuesFunction · 0.80
writeTableFunction · 0.80
creditsRunFunction · 0.80
listRunFunction · 0.80
StateTitleWithColorFunction · 0.80
printPrsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected