diff --git a/README.md b/README.md index ceb20db..13c6250 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ A Linux terminal recorder written in Python that renders your command line sessions as standalone SVG animations.

- +

-More examples of recordings can be found [here](https://github.com/nbedos/termtosvg/blob/0.3.0/examples/examples.md) +More examples of recordings can be found [here](https://github.com/nbedos/termtosvg/blob/0.4.0/examples/examples.md) ## Motivation I really like the clean look of SVG animations. I wanted to see @@ -119,12 +119,17 @@ 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. +section of the configuration file, or be used at the command line as a +parameter to the `--theme` flag. + +Definitions for the foreground and background colors and for color0 to +color7 are mandatory. If color8 through color15 (bright ANSI colors) are +defined, they are used by termtosvg to display bold characters as a +replacement for color0 through color7. ## Dependencies termtosvg uses: * [pyte](https://github.com/selectel/pyte) to render the terminal screen * [svgwrite](https://github.com/mozman/svgwrite) to create SVG animations * [base16-xresources](https://github.com/chriskempson/base16-xresources) for default color themes -* [rawgit](https://rawgit.com/) for SVG animation hosting (see also [rawgit on GitHub](https://github.com/rgrove/rawgit)) +* [rawgit](https://rawgit.com/) for hosting SVG animations displayed here on GitHub [rawgit on GitHub](https://github.com/rgrove/rawgit)) diff --git a/examples/examples.md b/examples/examples.md index 1f46f52..6751706 100644 --- a/examples/examples.md +++ b/examples/examples.md @@ -1,25 +1,25 @@ # Examples ## awesome.svg

- +

## colors.svg

- +

## ipython.svg

- +

## htop.svg

- +

## unittest.svg

- +

diff --git a/setup.py b/setup.py index 6a119d0..18c7889 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,9 @@ setup( name='termtosvg', - version='0.3.0', + version='0.4.0', + licence='BSD 3-clause license', + author='Nicolas Bedos', description='Record terminal sessions as SVG animations', long_description='A Linux terminal recorder written in Python ' 'which renders your command line sessions as ' diff --git a/termtosvg/config.py b/termtosvg/config.py index 9249f77..9a8f585 100644 --- a/termtosvg/config.py +++ b/termtosvg/config.py @@ -64,7 +64,7 @@ def conf_to_dict(configuration): """Read a configuration string in INI format and return a dictionary Raise a subclass of configparser.Error if parsing the configuration string fails - Raise ValueError if the color theme is invalid + Raise AsciiCastError if the color theme is invalid """ parser = configparser.ConfigParser(dict_type=CaseInsensitiveDict, comment_prefixes=(';',)) @@ -78,13 +78,16 @@ def conf_to_dict(configuration): themes = [theme.lower() for theme in parser.sections() if theme.lower() != 'global'] for theme_name in themes: - fg = parser.get(theme_name, 'foreground', fallback='') - bg = parser.get(theme_name, 'background', fallback='') + fg = parser.get(theme_name, 'foreground', fallback=None) + bg = parser.get(theme_name, 'background', fallback=None) palette = ':'.join(parser.get(theme_name, 'color{}'.format(i), fallback='') for i in range(16)) - # This line raises AsciicastError if the color theme is invalid - config_dict[theme_name] = asciicast.AsciiCastV2Theme(fg, bg, palette) + try: + config_dict[theme_name] = asciicast.AsciiCastV2Theme(fg, bg, palette) + except asciicast.AsciiCastError: + logger.error('Failed parsing color theme "{}"'.format(theme_name)) + raise return config_dict diff --git a/termtosvg/data/termtosvg.ini b/termtosvg/data/termtosvg.ini index 22d4d49..c9953a7 100644 --- a/termtosvg/data/termtosvg.ini +++ b/termtosvg/data/termtosvg.ini @@ -23,7 +23,7 @@ ; --help' font = DejaVu Sans Mono -theme = solarized-dark +theme = gjm8 ; All sections other than 'GLOBAL' define a color theme. You can add, delete @@ -37,13 +37,27 @@ theme = solarized-dark ; magenta, cyan, white) ; ; If color8 through color15 (bright ANSI colors) are defined, they are used by -; termtosvg, otherwise color0 through color7 are used as a replacement +; termtosvg to display bold characters as a replacement for color0 through +; color7. ; ; All color values must be in #rrggbb format ; -; Default colors themes come from the base16-xresources projet +; Default color themes come mostly from the base16-xresources projet ; https://github.com/chriskempson/base16-xresources +[gjm8] +; Source: https://terminal.sexy/ +foreground = #c5c5c5 +background = #1c1c1c +color0 = #1c1c1c +color1 = #ff005b +color2 = #cee318 +color3 = #ffe755 +color4 = #048ac7 +color5 = #833c9f +color6 = #0ac1cd +color7 = #e5e5e5 + [circus] ; Authors: Stephan Boyer (https://github.com/stepchowfun) and Esther Wang foreground = #a7a7a7