yarstu, another rich terminal screenshot utility
Find a file
2022-06-15 17:06:05 -05:00
assets feat: add non-optional drop-shadow 2022-06-15 17:06:05 -05:00
docs feat: add non-optional drop-shadow 2022-06-15 17:06:05 -05:00
scripts chore: add comparison to default settings 2022-06-15 15:35:29 -05:00
yartsu feat: add non-optional drop-shadow 2022-06-15 17:06:05 -05:00
.flake8 second commit 2022-06-14 18:46:20 -05:00
.gitignore second commit 2022-06-14 18:46:20 -05:00
.pre-commit-config.yaml chore: add comparison to default settings 2022-06-15 15:35:29 -05:00
LICENSE.txt feat: switch default font to support nerd fonts 2022-06-15 01:40:22 -05:00
Makefile chore: add comparison to default settings 2022-06-15 15:35:29 -05:00
pdm.lock second commit 2022-06-14 18:46:20 -05:00
pyproject.toml chore: add urls to project table 2022-06-15 00:57:19 -05:00
README.md feat: add non-optional drop-shadow 2022-06-15 17:06:05 -05:00

YARTSU

Logo

yartsu, another rich terminal screenshot utility


Stargazers Issues MIT License

NOTE: this is a currently in a beta release and the API is subject to change (feedback welcome)

Inspired by recent commits in the wonderful library rich I decided to write yartsu.

I needed to programatically generate screenshots for documentation purposes. The new export_svg methods in rich were a godsend. So I wanted to try to make this feature a little more generalizable to program ouptut outside of rich/python. Hopefully, you find it useful.

If you come across anything unexpected please submit an issue.

Install

pip install yartsu

You can also download the shiv based zipapp from the releases page.

Optionally with eget:

eget daylinmorgan/yartsu

This version will bundle depedencies and unpack them at ~/.shiv at first runtime. You can change this location by setting the SHIV_ROOT environment variable. See shiv for more info.

Usage

Logo

Getting a properly formatted output from a terminal screenshot is challenging.

There are three options for generating a screenshot.

If one of the below option causes you any headaches consider first trying a different option.

Option 1: Pipes

Many tools that color output (i.e. grep or ls) additionally allow you to force ANSI color codes to be included even when piping output.

In these cases you can simply pipe the output directly into yartsu

ls --color=always | yartsu -w 50 -o assets/ls_color.svg

Option 2: Subprocess/Pty

With this option yartsu will deploy a subprocess and pty to run your command for you in an attempt to preserve ANSI.

Note with this option you need to seperate the command you want to run with yartsu args using --.

yartsu -w 50 -o assets/ls_color.svg -- ls --color /

Option 3: Text File

Finally, if you neither of the above options work and you can manage to preserve the codes in a plain text file you can pass this as input to yartsu.

ls --color > ls.txt
yartsu -w 50 -i ls.txt -o assets/ls_color.svg

By default svgs will be saved at ./capture.svg.

Additionally, for options 1 and 3 you may want to define your own title with -t/--title. For option 2 the title will by default be the cmd ran by yartsu.

Themes:

There are a number of themes you can use to style output. Use yartsu --list-themes to see the available options. Then you can specify the theme you want with --theme, i.e. yartsu --theme rich_default. You may also use the environment variable YARTSU_THEME.

See here a preview of the available themes

Supported Characters

Currently yartsu loads the nerd font patched FiraCode font. This should result in general support for emoji's and nerd font icons.

Logo

Note: github won't load the font's when displaying on the README. Click on the svg to see the nerd font icons.

TODO

  • add unit tests
  • add support for nerd-fonts
  • add optional shadow
  • add more themes