Module

environment.filters._terminal

Terminal style, layout, and data-rendering filters for Kida templates.

Provides ANSI color/decoration filters, layout helpers (pad, table, tree), and data-display filters (badge, bar, kv, syntax) for terminal-mode output.

All style filters returnStyled strings. The make_terminal_filters factory produces a filter dict with closures bound to the caller's color/unicode capabilities.

Functions

make_terminal_filters 3 dict[str, Any]
Build terminal filter dict with closures bound to capability flags.
def make_terminal_filters(color: bool = True, unicode: bool = True, color_depth: str | None = None) -> dict[str, Any]
Parameters
Name Type Description
color bool

Whether ANSI color codes should be emitted.

Default:True
unicode bool

Whether Unicode box-drawing / icon characters are available.

Default:True
color_depth str | None

Terminal color depth:"none", "basic", "256", or "truecolor". When provided, fg() and bg() degrade gracefully — e.g. RGB values are mapped to the nearest 256-color or basic-16 code when the terminal doesn't support truecolor. If None, falls back to "truecolor"when color is True.

Default:None
Returns
dict[str, Any]