Newer
Older
navi-1 / clients / terminal / tui / renderers / plain.py
"""Fallback plain text renderer."""

from __future__ import annotations

from rich.console import RenderableType
from rich.text import Text

from .base import ContentRenderer


class PlainRenderer(ContentRenderer):
    """Render any event as plain text; always accepts as fallback."""

    def accepts(self, msg: dict) -> bool:
        return True

    def render(self, msg: dict) -> RenderableType:
        text = msg.get("content", "") or str(msg)
        return Text(text, style="bright_white")