StyleText maps ASCII letters/digits to the mode's Unicode variant.
(s string, mode TextStyleMode)
| 375 | |
| 376 | // StyleText maps ASCII letters/digits to the mode's Unicode variant. |
| 377 | func StyleText(s string, mode TextStyleMode) string { |
| 378 | if mode == TextPlain { |
| 379 | return s |
| 380 | } |
| 381 | var b strings.Builder |
| 382 | b.Grow(len(s) * 4) |
| 383 | for _, r := range s { |
| 384 | b.WriteRune(styleRune(r, mode)) |
| 385 | } |
| 386 | return b.String() |
| 387 | } |
| 388 | |
| 389 | // StyleViewText applies styleRune to a pre-rendered string while passing |
| 390 | // through ANSI CSI escape sequences untouched. Useful when post-processing |
no test coverage detected