Generate colorful screenshots of terminal commands
Project description
richterm
richterm turns arbitrary terminal commands into Rich-rendered SVG images. 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
To install the tool permanently:
uv tool install richterm
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] [--shown-command STR] <command...>
--hide-commandhides the prompt and command line in the transcript.--promptaccepts Rich markup and defaults to$.-o/--outputselects the SVG path; otherwise a timestamped filename is generated.--shown-commandlets you display a different command than the one executed (handy when a fixture command would distract readers). Cannot be combined with--hide-command.
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')"
richterm --shown-command "pytest -q" python -c "print('actually running something else')"
Sphinx integration
richterm optionally works as a Sphinx extension. Install the extras and enable it in your conf.py:
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:
```{richterm} python -m rich --force-terminal --no-color-system example
```
Or in 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
Or directly make test
Build the documentation (which exercises the directive itself):
make docs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file richterm-0.2.0.tar.gz.
File metadata
- Download URL: richterm-0.2.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f96276f7b16a88595e9cfc190c3218d1a3922cfd7b377c835c2f8d8ab97489a4
|
|
| MD5 |
6b9569732ddb2e223437dfe094013940
|
|
| BLAKE2b-256 |
c945ef839b7b4537aaa924c294ddacc262622dc07c35a1c0c830dc3b026ec8f8
|
Provenance
The following attestation bundles were made for richterm-0.2.0.tar.gz:
Publisher:
cd.yml on mgaitan/richterm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
richterm-0.2.0.tar.gz -
Subject digest:
f96276f7b16a88595e9cfc190c3218d1a3922cfd7b377c835c2f8d8ab97489a4 - Sigstore transparency entry: 769157117
- Sigstore integration time:
-
Permalink:
mgaitan/richterm@8a01da5c337700e797c446443b58d3c5751e6500 -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/mgaitan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@8a01da5c337700e797c446443b58d3c5751e6500 -
Trigger Event:
release
-
Statement type:
File details
Details for the file richterm-0.2.0-py3-none-any.whl.
File metadata
- Download URL: richterm-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff3682fb511c721df256b95e3fd97b50723e831417dde3b730212864c288224c
|
|
| MD5 |
8d10357c75a7f8bd4522c2f5fdfb52aa
|
|
| BLAKE2b-256 |
3970d5b2d1028923de902ce81ccecb1a7da7d8c27f121c7416e4a66825be6a58
|
Provenance
The following attestation bundles were made for richterm-0.2.0-py3-none-any.whl:
Publisher:
cd.yml on mgaitan/richterm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
richterm-0.2.0-py3-none-any.whl -
Subject digest:
ff3682fb511c721df256b95e3fd97b50723e831417dde3b730212864c288224c - Sigstore transparency entry: 769157121
- Sigstore integration time:
-
Permalink:
mgaitan/richterm@8a01da5c337700e797c446443b58d3c5751e6500 -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/mgaitan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@8a01da5c337700e797c446443b58d3c5751e6500 -
Trigger Event:
release
-
Statement type: