Skip to main content

Generate colorful screenshots of terminal commands

Project description

richterm

ci docs pypi version Changelog Ruff License

richterm turns arbitrary terminal commands into Rich-rendered SVG transcripts. Run it from the command line or embed live captures in Sphinx documentation with a dedicated directive.

Quick start

Run the CLI without installing anything permanently:

uvx richterm -- python -m rich

Install globally when you are ready:

uv tool install richterm
richterm --prompt "[bold green]❯" python -c "print('hello')"

Each invocation writes an SVG named rich_term_<TIMESTAMP>.svg (or the file passed with -o/--output) and echoes the command output back to the terminal.

To keep colours vibrant even in non-interactive captures, richterm sets friendly defaults: TERM=xterm-256color (when missing) plus FORCE_COLOR=1, CLICOLOR_FORCE=1, PY_COLORS=1, and TTY_COMPATIBLE=1 unless you override them. Opt out with RICHTERM_DISABLE_COLOR_HINT=1 or by exporting NO_COLOR.

Command-line usage

usage: richterm [-h|--hide-command] [-o PATH] [--prompt STR] <command...>
  • --hide-command hides the prompt and command line in the transcript.
  • --prompt accepts Rich markup and defaults to $.
  • -o/--output selects the SVG path; otherwise a timestamped filename is generated.

Examples:

richterm ls -la
richterm --prompt "[bold blue]λ" -o docs/_static/listing.svg git status --short
richterm --hide-command python -c "print('\033[31merror\033[0m')"

Sphinx integration

Install the optional Sphinx extras and enable the extension:

uv add richterm[sphinx]
# docs/conf.py
extensions = [
    "myst_parser",
    "sphinxcontrib.mermaid",
    "richterm.sphinxext",
]
richterm_prompt = "[bold]$"
richterm_hide_command = False

Then use the directive in MyST or reStructuredText:

```{richterm} python -m rich --force-terminal --no-color-system example
```

The directive executes the command during the build, embeds the SVG directly in HTML output, and falls back to a literal block for non-HTML builders. The :prompt: and :hide-command: options mirror the CLI flags.

Development

Tests depend on the Sphinx extras:

uv run --extra sphinx pytest

Build the documentation (which exercises the directive itself):

make docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

richterm-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

richterm-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file richterm-0.1.0.tar.gz.

File metadata

  • Download URL: richterm-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for richterm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d4eadab4c1eaae0388f7f1b2b96d569056c79827237d662e60a4128019a820d8
MD5 f65a5f52fc61459b26b10368d92fe795
BLAKE2b-256 c3d20116d441380ca7eb67f29c7400a1e5ae4bcdfb90f14f5d3fff4169cd0907

See more details on using hashes here.

Provenance

The following attestation bundles were made for richterm-0.1.0.tar.gz:

Publisher: cd.yml on mgaitan/richterm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file richterm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: richterm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for richterm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7b51dad405e3946df61eb9d9e32658633341fb53be6d3030abf86e7c637afed
MD5 45aa362df7b89ad3c1087061b9239288
BLAKE2b-256 31ceeeeb28042b18a11cb5f232a048061abb86001518bd5327c52f41011b2ee2

See more details on using hashes here.

Provenance

The following attestation bundles were made for richterm-0.1.0-py3-none-any.whl:

Publisher: cd.yml on mgaitan/richterm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page