> ## Documentation Index
> Fetch the complete documentation index at: https://aspect.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Theme

`function` **Theme.bg**

<pre language="python">
  `def Theme.bg(
  role: str,
  /,
  *,
  stream: typing.Any = "stderr",
  default: None | str = None
  ) -> str`
</pre>

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**

<pre language="python">
  `def Theme.depth(
  *,
  stream: typing.Any = "stderr"
  ) -> int`
</pre>

The colour depth `stream` is drawn at: 24 (24-bit), 256 or 16, and 0 when it takes no colour.

`function` **Theme.fg**

<pre language="python">
  `def Theme.fg(
  role: str,
  /,
  *,
  stream: typing.Any = "stderr",
  default: None | str = None
  ) -> str`
</pre>

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**

<pre language="python">
  `def Theme.info() -> typing.Any`
</pre>

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**

<pre language="python">
  `def Theme.paint(
  role: str,
  text: str,
  /,
  *,
  stream: typing.Any = "stderr",
  default: None | str = None
  ) -> str`
</pre>

`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**

<pre language="python">
  `def Theme.params(
  role: str,
  /,
  *,
  default: None | str = None
  ) -> str`
</pre>

`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**

<pre language="python">
  `def Theme.sgr(
  role: str,
  /,
  *,
  stream: typing.Any = "stderr",
  default: None | str = None
  ) -> str`
</pre>

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**

<pre language="python">
  `def Theme.testonly_pin(
  name: str,
  /,
  *,
  depth: int = 256,
  appearance: str = "dark"
  ) -> None`
</pre>

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**

<pre language="python">
  `Theme.reset: str`
</pre>

The SGR reset, `"\x1b[0m"`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.