Skip to content

TerminalConfig

Module: terminaltexteffects.engine.terminal

Bases: ArgsDataClass

Configuration for the terminal.

Attributes:

Name Type Description
tab_width int

Number of spaces to use for a tab character.

xterm_colors bool

Convert any colors specified in RBG hex to the closest XTerm-256 color.

no_color bool

Disable all colors in the effect.

wrap_text bool

Wrap text wider than the canvas width.

frame_rate float

Target frame rate for the animation.

canvas_width int

Cavas width, if set to 0 the canvas width is detected automatically based on the terminal device.

canvas_height int

Canvas height, if set to 0 the canvas height is detected automatically based on the terminal device.

anchor_canvas Literal['sw', 's', 'se', 'e', 'ne', 'n', 'nw', 'w', 'c']

Anchor point for the Canvas. The Canvas will be anchored in the terminal to the location corresponding to the cardinal/diagonal direction. Defaults to 'sw'.

anchor_effect Literal['sw', 's', 'se', 'e', 'ne', 'n', 'nw', 'w', 'c']

Anchor point for the effect within the Canvas. Effect text will anchored in the Canvas to the location corresponding to the cardinal/diagonal direction. Defaults to 'sw'.

ignore_terminal_dimensions bool

Ignore the terminal dimensions and utilize the full Canvas beyond the extents of the terminal. Useful for sending frames to another output handler.

Source code in terminaltexteffects/engine/terminal.py
@dataclass
class TerminalConfig(ArgsDataClass):
    """Configuration for the terminal.

    Attributes:
        tab_width (int): Number of spaces to use for a tab character.
        xterm_colors (bool): Convert any colors specified in RBG hex to the closest XTerm-256 color.
        no_color (bool): Disable all colors in the effect.
        wrap_text (bool): Wrap text wider than the canvas width.
        frame_rate (float): Target frame rate for the animation.
        canvas_width (int): Cavas width, if set to 0 the canvas width is detected automatically based on the terminal device.
        canvas_height (int): Canvas height, if set to 0 the canvas height is detected automatically based on the terminal device.
        anchor_canvas (Literal['sw','s','se','e','ne','n','nw','w','c']): Anchor point for the Canvas. The Canvas will be anchored in the terminal to the location corresponding to the cardinal/diagonal direction. Defaults to 'sw'.
        anchor_effect (Literal['sw','s','se','e','ne','n','nw','w','c']): Anchor point for the effect within the Canvas. Effect text will anchored in the Canvas to the location corresponding to the cardinal/diagonal direction. Defaults to 'sw'.
        ignore_terminal_dimensions (bool): Ignore the terminal dimensions and utilize the full Canvas beyond the extents of the terminal. Useful for sending frames to another output handler.
    """

    tab_width: int = ArgField(
        cmd_name=["--tab-width"],
        type_parser=argvalidators.PositiveInt.type_parser,
        metavar=argvalidators.PositiveInt.METAVAR,
        default=4,
        help="Number of spaces to use for a tab character.",
    )  # type: ignore[assignment]

    "int : Number of spaces to use for a tab character."

    xterm_colors: bool = ArgField(
        cmd_name=["--xterm-colors"],
        default=False,
        action="store_true",
        help="Convert any colors specified in RBG hex to the closest XTerm-256 color.",
    )  # type: ignore[assignment]

    "bool : Convert any colors specified in RBG hex to the closest XTerm-256 color."

    no_color: bool = ArgField(
        cmd_name=["--no-color"], default=False, action="store_true", help="Disable all colors in the effect."
    )  # type: ignore[assignment]

    "bool : Disable all colors in the effect."

    wrap_text: int = ArgField(
        cmd_name="--wrap-text", default=False, action="store_true", help="Wrap text wider than the canvas width."
    )  # type: ignore[assignment]
    "bool : Wrap text wider than the canvas width."

    frame_rate: float = ArgField(
        cmd_name="--frame-rate",
        type_parser=argvalidators.PositiveInt.type_parser,
        default=100,
        help="""Target frame rate for the animation.""",
    )  # type: ignore[assignment]

    "float : Minimum time, in seconds, between frames."

    canvas_width: int = ArgField(
        cmd_name=["--canvas-width"],
        metavar=argvalidators.CanvasDimension.METAVAR,
        type_parser=argvalidators.CanvasDimension.type_parser,
        default=-1,
        help="Canvas width, set to an integer > 0 to use a specific dimension, or use 0, or -1 to set the dimension based off the input data or the terminal device, respectively.",
    )  # type: ignore[assignment]

    "int : Canvas width, if set to 0 the canvas width is detected automatically based on the terminal device, if set to -1 the canvas width is based on the input data width."

    canvas_height: int = ArgField(
        cmd_name=["--canvas-height"],
        metavar=argvalidators.CanvasDimension.METAVAR,
        type_parser=argvalidators.CanvasDimension.type_parser,
        default=-1,
        help="Canvas height, set to an integer > 0 to use a specific dimension, or use 0, or -1 to set the dimension based off the input data or the terminal device, respectively.",
    )  # type: ignore[assignment]

    "int : Canvas height, if set to 0 the canvas height is is detected automatically based on the terminal device, if set to -1 the canvas width is based on the input data height."

    anchor_canvas: Literal["sw", "s", "se", "e", "ne", "n", "nw", "w", "c"] = ArgField(
        cmd_name=["--anchor-canvas"],
        choices=["sw", "s", "se", "e", "ne", "n", "nw", "w", "c"],
        default="sw",
        help="Anchor point for the canvas. The canvas will be anchored in the terminal to the location corresponding to the cardinal/diagonal direction.",
    )  # type: ignore[assignment]

    "Literal['sw','s','se','e','ne','n','nw','w','c'] : Anchor point for the canvas. The canvas will be anchored in the terminal to the location corresponding to the cardinal/diagonal direction."

    anchor_text: Literal["n", "ne", "e", "se", "s", "sw", "w", "nw", "c"] = ArgField(
        cmd_name=["--anchor-text"],
        choices=["n", "ne", "e", "se", "s", "sw", "w", "nw", "c"],
        default="sw",
        help="Anchor point for the text within the Canvas. Input text will anchored in the Canvas to the location corresponding to the cardinal/diagonal direction.",
    )  # type: ignore[assignment]

    "Literal['n','ne','e','se','s','sw','w','nw','c'] : Anchor point for the text within the Canvas. Input text will anchored in the Canvas to the location corresponding to the cardinal/diagonal direction."

    ignore_terminal_dimensions: bool = ArgField(
        cmd_name=["--ignore-terminal-dimensions"],
        default=False,
        action="store_true",
        help="Ignore the terminal dimensions and utilize the full Canvas beyond the extents of the terminal. Useful for sending frames to another output handler.",
    )  # type: ignore[assignment]
    "bool : Ignore the terminal dimensions and utilize the full Canvas beyond the extents of the terminal. Useful for sending frames to another output handler."

anchor_canvas: Literal['sw', 's', 'se', 'e', 'ne', 'n', 'nw', 'w', 'c'] = ArgField(cmd_name=['--anchor-canvas'], choices=['sw', 's', 'se', 'e', 'ne', 'n', 'nw', 'w', 'c'], default='sw', help='Anchor point for the canvas. The canvas will be anchored in the terminal to the location corresponding to the cardinal/diagonal direction.') class-attribute instance-attribute

Literal['sw','s','se','e','ne','n','nw','w','c'] : Anchor point for the canvas. The canvas will be anchored in the terminal to the location corresponding to the cardinal/diagonal direction.

anchor_text: Literal['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'c'] = ArgField(cmd_name=['--anchor-text'], choices=['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'c'], default='sw', help='Anchor point for the text within the Canvas. Input text will anchored in the Canvas to the location corresponding to the cardinal/diagonal direction.') class-attribute instance-attribute

Literal['n','ne','e','se','s','sw','w','nw','c'] : Anchor point for the text within the Canvas. Input text will anchored in the Canvas to the location corresponding to the cardinal/diagonal direction.

canvas_height: int = ArgField(cmd_name=['--canvas-height'], metavar=argvalidators.CanvasDimension.METAVAR, type_parser=argvalidators.CanvasDimension.type_parser, default=-1, help='Canvas height, set to an integer > 0 to use a specific dimension, or use 0, or -1 to set the dimension based off the input data or the terminal device, respectively.') class-attribute instance-attribute

int : Canvas height, if set to 0 the canvas height is is detected automatically based on the terminal device, if set to -1 the canvas width is based on the input data height.

canvas_width: int = ArgField(cmd_name=['--canvas-width'], metavar=argvalidators.CanvasDimension.METAVAR, type_parser=argvalidators.CanvasDimension.type_parser, default=-1, help='Canvas width, set to an integer > 0 to use a specific dimension, or use 0, or -1 to set the dimension based off the input data or the terminal device, respectively.') class-attribute instance-attribute

int : Canvas width, if set to 0 the canvas width is detected automatically based on the terminal device, if set to -1 the canvas width is based on the input data width.

frame_rate: float = ArgField(cmd_name='--frame-rate', type_parser=argvalidators.PositiveInt.type_parser, default=100, help='Target frame rate for the animation.') class-attribute instance-attribute

float : Minimum time, in seconds, between frames.

ignore_terminal_dimensions: bool = ArgField(cmd_name=['--ignore-terminal-dimensions'], default=False, action='store_true', help='Ignore the terminal dimensions and utilize the full Canvas beyond the extents of the terminal. Useful for sending frames to another output handler.') class-attribute instance-attribute

bool : Ignore the terminal dimensions and utilize the full Canvas beyond the extents of the terminal. Useful for sending frames to another output handler.

no_color: bool = ArgField(cmd_name=['--no-color'], default=False, action='store_true', help='Disable all colors in the effect.') class-attribute instance-attribute

bool : Disable all colors in the effect.

tab_width: int = ArgField(cmd_name=['--tab-width'], type_parser=argvalidators.PositiveInt.type_parser, metavar=argvalidators.PositiveInt.METAVAR, default=4, help='Number of spaces to use for a tab character.') class-attribute instance-attribute

int : Number of spaces to use for a tab character.

wrap_text: int = ArgField(cmd_name='--wrap-text', default=False, action='store_true', help='Wrap text wider than the canvas width.') class-attribute instance-attribute

bool : Wrap text wider than the canvas width.

xterm_colors: bool = ArgField(cmd_name=['--xterm-colors'], default=False, action='store_true', help='Convert any colors specified in RBG hex to the closest XTerm-256 color.') class-attribute instance-attribute

bool : Convert any colors specified in RBG hex to the closest XTerm-256 color.