Skip to main content
function Theme.bg
def Theme.bg(
role: str,
/,
*,
stream: typing.Any = “stderr”,
default: None | str = None
) -> str
Only role’s background, as an escape ("\x1b[48;5;24m"), as fg is for the foreground: a selection, a hovered tab, a search match. function Theme.depth
def Theme.depth(
*,
stream: typing.Any = “stderr”
) -> int
The colour depth stream is drawn at: 24 (24-bit), 256 or 16, and 0 when it takes no colour. function Theme.fg
def Theme.fg(
role: str,
/,
*,
stream: typing.Any = “stderr”,
default: None | str = None
) -> str
Only role’s foreground, as an escape ("\x1b[38;5;203m"); "" when it has none or stream takes no colour. For a surface that combines one role’s text colour with another’s background. function Theme.info
def Theme.info() -> typing.Any
What the run’s theme is: name (the variant, aspect-dark), family (aspect, or None), appearance (dark, light or any), background (dark or light when the terminal’s is known, else None), follows_terminal (whether the background is unknown, so its status roles take the terminal’s own colours), bazel (shared or tool), hyperlinks (whether the terminal opens OSC 8 links), syntax_theme (a syntect theme name, or None) and roles (every role name). function Theme.paint
def Theme.paint(
role: str,
text: str,
/,
*,
stream: typing.Any = “stderr”,
default: None | str = None
) -> str
text in role, then a reset; text alone when stream takes no colour or the role has no styling. default as for sgr. function Theme.params
def Theme.params(
role: str,
/,
*,
default: None | str = None
) -> str
role’s SGR parameters ("1;38;5;203"), whatever any stream takes: for composing a sequence of one’s own. "" for no styling. function Theme.sgr
def Theme.sgr(
role: str,
/,
*,
stream: typing.Any = “stderr”,
default: None | str = None
) -> str
The escape that opens role ("\x1b[1;38;5;203m"), or "" when stream takes no colour or the role has no styling. default is a role value ("@highlight") for a role of a plugin’s own that the theme may not define. A role the theme does not have, with no default, fails. function Theme.testonly_pin
def Theme.testonly_pin(
name: str,
/,
*,
depth: int = 256,
appearance: str = “dark”
) -> None
Pin the run’s theme to the built-in name (a family takes its appearance variant) at depth (24, 256 or 16), its background known: for a test that asserts the escapes a theme writes, whatever the environment it runs in. Only a test may call it: code in a *_test.axl file, or the runtime’s own tests; anywhere else it fails. property Theme.reset
Theme.reset: str
The SGR reset, "\x1b[0m".