TerminalTheme
The default {@see TerminalThemeInterface}: a fixed role => SGR-code mapping and a fixed symbol => glyph mapping, both overridable per instance (symbols via `$symbols`; roles are not currently caller-configurable). Ships with `ansi` disabled by default, so constructing one with no arguments is always a safe, styling-free theme.
TerminalTheme::__construct()
public function __construct(bool $ansi = false, array $symbols = []):Parameters
| Name | Type | Description |
|---|---|---|
| $ansi | bool | Whether to actually emit ANSI escapes; when `false`, {@see style()} always returns its input unchanged. |
| $symbols | array<string, string> | Overrides for specific symbol names, consulted before the built-in defaults in {@see symbol()}. |
TerminalTheme::ansiEnabled()
public function ansiEnabled(): boolTerminalTheme::style()
public function style(string $text, string $role): stringThe text wrapped in the ANSI styling this theme assigns to the semantic role.
Parameters
| Name | Type | Description |
|---|---|---|
| $text | string | |
| $role | string |
TerminalTheme::symbol()
public function symbol(string $name): stringThe glyph this theme uses for the named symbol, so a renderer never hardcodes one.
Parameters
| Name | Type | Description |
|---|---|---|
| $name | string |