def style

bend-kit-tty@0.1.0.1 · text.bend:6

import bend-kit-tty@0.1.0.1/text.bend as Text
import Base

6# Wrap text in one numeric SGR code and a reset when enabled; otherwise return it unchanged.
7def style(enabled: Bool, code: U32, text: String) -> String:
8  match enabled:
9    case True{}:
10      String.concat(["\u{1B}[", U32.show(code), "m", text, "\u{1B}[0m"])
11    case False{}:
12      text

Uses (6)

Used by (1)