Skip to content

styleText

styleText(text, options?): string

Defined in: packages/format-ansi/src/color.ts:69

Wraps text in SGR escape codes for the requested styles/colors, reset at the end. foreground/background are always specified as truecolor RGB and downsampled to colorDepth here — callers never hand-pick a palette index themselves.

colorDepth: 1 (monochrome) drops foreground/background entirely; styles (bold, underline, …) still apply, since those aren’t color.

string

StyleTextOptions

string