(s string)
| 234 | } |
| 235 | |
| 236 | func (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. |
| 266 | func (c *ColorScheme) Label(hex string, x string) string { |
no outgoing calls
no test coverage detected