Skip to content
docsv0.3.0

TuiAnsiPainter

Applies color as a final pass over already-composed retained-path output lines by matching literal box-drawing/glyph characters and resolving their color through an injected {@see TerminalThemeInterface} instead of hardcoded ANSI sequences -- the one ANSI/theme contract both TUI runtimes now share. The painter always needs an ansi-enabled theme (its entire job is to add color), so the default theme it falls back to forces `ansi: true` regardless of what the caller's own theme instance (if any) is configured for elsewhere.

TuiAnsiPainter::__construct()

public function __construct(Milpa\Live\Contracts\Tui\TerminalThemeInterface $theme = new TerminalTheme()):

Parameters

Parameters of __construct()
NameTypeDescription
$themeMilpa\Live\Contracts\Tui\TerminalThemeInterface

TuiAnsiPainter::paint()

public function paint(array $lines): string

Colors known box-drawing/glyph characters in `$lines` via the injected theme and joins them with a trailing reset escape, so output composed without any color awareness gets themed retroactively. Text this painter does not recognize as a themed glyph passes through unchanged.

Parameters

Parameters of paint()
NameTypeDescription
$linesarray<int, string>Already-composed, unthemed output lines.