Code Monkey home page Code Monkey logo

termtosvg's Introduction

Build Status

termtosvg

A Linux terminal recorder written in Python which renders your command line sessions as standalone SVG animations.

More examples of recordings here

Motivation

I really like the clean look of SVG animations and I also wanted to see how this solution would hold out against other attempts at terminal recording such as asciinema.

Installation

termtosvg is compatible with Python >= 3.5 and can be installed with pip:

pip install termtosvg

Usage

Basic usage

Start recording with:

$ termtosvg
Recording started, enter "exit" command or Control-D to end

You are now in a subshell where you can type your commands as usual. Once you are done, exit the shell to end the recording:

$ exit
Recording ended, file is /tmp/termtosvg_exp5nsr4.svg

Finally, use your favorite web browser to play the animation:

$ firefox /tmp/termtosvg_exp5nsr4.svg

Detailed usage

$ termtosvg --help
usage: termtosvg [output_file] [--font FONT] [--theme THEME] [--help] [--verbose]
Record a terminal session and render an SVG animation on the fly

positional arguments:
  output_file    optional filename of the SVG animation; if missing, a random
                 filename will be automatically generated

optional arguments:
  -h, --help     show this help message and exit
  --font FONT    font to specify in the CSS portion of the SVG animation
                 (DejaVu Sans Mono, Monaco...). If the font is not installed
                 on the viewer's machine, the browser will display a default
                 monospaced font instead.
  --theme THEME  color theme used to render the terminal session (circus,
                 classic-dark, classic-light, dracula, isotope, marrakesh,
                 material, monokai, solarized-dark, solarized-light, zenburn)
  -v, --verbose  increase log messages verbosity

See also 'termtosvg record --help' and 'termtosvg render --help'

Subcommands

Rendering the SVG animation while recording might sometimes slow the commands being executed a bit because of the CPU usage, so it is possible to proceed in two steps:

  1. Record the terminal session to disk in asciicast v2 format
  2. Render the SVG animation using the recording on disk

The detailed usage of these two commands is available with termtosvg record --help and termtosvg render --help

Configuration

termtosvg configuration file is located at ~/.config/termtosvg/termtosvg.ini and will be created by termtosvg if it does not exist. The configuration file is self-documenting but here are the basics.

Global section

The 'global' section of the file specifies the font and color theme used.

[global]
font = DejaVu Sans Mono
theme = solarized-dark

These options can be overridden at the command line with the --font and --theme flags.

Color themes

All other sections of the file define color themes. For example here's the definition of the theme 'circus':

[circus]
foreground = #a7a7a7
background = #191919
color0 = #191919
color1 = #dc657d
color2 = #84b97c
color3 = #c3ba63
color4 = #639ee4
color5 = #b888e2
color6 = #4bb1a7
color7 = #a7a7a7
color8 = #5f5a60
color9 = #4bb1a7
color10 = #202020
color11 = #303030
color12 = #505050
color13 = #808080
color14 = #b888e2
color15 = #ffffff

Color themes can freely be added, removed or modified. Once a color theme has been added to the configuration it can be referred to in the global section of the configuration, or be used at the command line as a parameter to the --theme flag.

Dependencies

termtosvg uses:

termtosvg's People

Contributors

nbedos avatar jwilk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.