Skip to content

textual.constants

This module contains constants, which may be set in environment variables.

COLOR_SYSTEM module-attribute

COLOR_SYSTEM: Final[str | None] = get_environ(
    "TEXTUAL_COLOR_SYSTEM", "auto"
)

Force color system override.

DEBUG module-attribute

DEBUG: Final[bool] = _get_environ_bool('TEXTUAL_DEBUG')

Enable debug mode.

DEFAULT_THEME module-attribute

DEFAULT_THEME: Final[str] = get_environ(
    "TEXTUAL_THEME", "textual-dark"
)

Textual theme to make default. More than one theme may be specified in a comma separated list. Textual will use the first theme that exists.

DEVTOOLS_HOST module-attribute

DEVTOOLS_HOST: Final[str] = get_environ(
    "TEXTUAL_DEVTOOLS_HOST", "127.0.0.1"
)

The host where textual console is running.

DEVTOOLS_PORT module-attribute

DEVTOOLS_PORT: Final[int] = _get_environ_port(
    "TEXTUAL_DEVTOOLS_PORT", 8081
)

Constant with the port that the devtools will connect to.

DIM_FACTOR module-attribute

DIM_FACTOR: Final[float] = (
    _get_environ_int(
        "TEXTUAL_DIM_FACTOR", 66, minimum=0, maximum=100
    )
    / 100
)

Percentage to use as opacity when converting ANSI 'dim' attribute to RGB.

DRIVER module-attribute

DRIVER: Final[str | None] = get_environ(
    "TEXTUAL_DRIVER", None
)

Import for replacement driver.

ESCAPE_DELAY module-attribute

ESCAPE_DELAY: Final[float] = (
    _get_environ_int("ESCDELAY", 100, minimum=1) / 1000.0
)

The delay (in seconds) before reporting an escape key (not used if the extend key protocol is available).

FILTERS module-attribute

FILTERS: Final[str] = get_environ('TEXTUAL_FILTERS', '')

A list of filters to apply to renderables.

LOG_FILE module-attribute

LOG_FILE: Final[str | None] = get_environ(
    "TEXTUAL_LOG", None
)

A last resort log file that appends all logs, when devtools isn't working.

MAX_FPS module-attribute

MAX_FPS: Final[int] = _get_environ_int(
    "TEXTUAL_FPS", 60, minimum=1
)

Maximum frames per second for updates.

PRESS module-attribute

PRESS: Final[str] = get_environ('TEXTUAL_PRESS', '')

Keys to automatically press.

SCREENSHOT_DELAY module-attribute

SCREENSHOT_DELAY: Final[int] = _get_environ_int(
    "TEXTUAL_SCREENSHOT", -1, minimum=-1
)

Seconds delay before taking screenshot, -1 for no screenshot.

SCREENSHOT_FILENAME module-attribute

SCREENSHOT_FILENAME: Final[str | None] = get_environ(
    "TEXTUAL_SCREENSHOT_FILENAME"
)

The filename to use for the screenshot.

SCREENSHOT_LOCATION module-attribute

SCREENSHOT_LOCATION: Final[str | None] = get_environ(
    "TEXTUAL_SCREENSHOT_LOCATION"
)

The location where screenshots should be written.

SHOW_RETURN module-attribute

SHOW_RETURN: Final[bool] = _get_environ_bool(
    "TEXTUAL_SHOW_RETURN"
)

Write the return value on exit.

SLOW_THRESHOLD module-attribute

SLOW_THRESHOLD: int = _get_environ_int(
    "TEXTUAL_SLOW_THRESHOLD", 500, minimum=100
)

The time threshold (in milliseconds) after which a warning is logged if message processing exceeds this duration.

SMOOTH_SCROLL module-attribute

SMOOTH_SCROLL: Final[bool] = (
    _get_environ_int("TEXTUAL_SMOOTH_SCROLL", 1) == 1
)

Should smooth scrolling be enabled? set TEXTUAL_SMOOTH_SCROLL=0 to disable smooth scrolling.

TEXTUAL_ANIMATIONS module-attribute

TEXTUAL_ANIMATIONS: Final[AnimationLevel] = (
    _get_textual_animations()
)

Determines whether animations run or not.