Skip to content
This repository was archived by the owner on Jun 16, 2020. It is now read-only.

Commit 464f5ea

Browse files
committed
Merge branch 'release/0.4.0'
2 parents 3a401f3 + 502a31d commit 464f5ea

File tree

5 files changed

+43
-19
lines changed

5 files changed

+43
-19
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ A Linux terminal recorder written in Python that renders your command
55
line sessions as standalone SVG animations.
66

77
<p align="center">
8-
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.3.0/examples/awesome.svg">
8+
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.4.0/examples/awesome.svg">
99
</p>
1010

11-
More examples of recordings can be found [here](https://github.com/nbedos/termtosvg/blob/0.3.0/examples/examples.md)
11+
More examples of recordings can be found [here](https://github.com/nbedos/termtosvg/blob/0.4.0/examples/examples.md)
1212

1313
## Motivation
1414
I really like the clean look of SVG animations. I wanted to see
@@ -119,12 +119,17 @@ color15 = #ffffff
119119

120120
Color themes can freely be added, removed or modified. Once a color theme
121121
has been added to the configuration it can be referred to in the global
122-
section of the configuration, or be used at the command line as a parameter
123-
to the `--theme` flag.
122+
section of the configuration file, or be used at the command line as a
123+
parameter to the `--theme` flag.
124+
125+
Definitions for the foreground and background colors and for color0 to
126+
color7 are mandatory. If color8 through color15 (bright ANSI colors) are
127+
defined, they are used by termtosvg to display bold characters as a
128+
replacement for color0 through color7.
124129

125130
## Dependencies
126131
termtosvg uses:
127132
* [pyte](https://github.com/selectel/pyte) to render the terminal screen
128133
* [svgwrite](https://github.com/mozman/svgwrite) to create SVG animations
129134
* [base16-xresources](https://github.com/chriskempson/base16-xresources) for default color themes
130-
* [rawgit](https://rawgit.com/) for SVG animation hosting (see also [rawgit on GitHub](https://github.com/rgrove/rawgit))
135+
* [rawgit](https://rawgit.com/) for hosting SVG animations displayed here on GitHub [rawgit on GitHub](https://github.com/rgrove/rawgit))

examples/examples.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
# Examples
22
## awesome.svg
33
<p align="center">
4-
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.3.0/examples/awesome.svg">
4+
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.4.0/examples/awesome.svg">
55
</p>
66

77
## colors.svg
88
<p align="center">
9-
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.3.0/examples/colors.svg">
9+
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.4.0/examples/colors.svg">
1010
</p>
1111

1212
## ipython.svg
1313
<p align="center">
14-
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.3.0/examples/ipython.svg">
14+
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.4.0/examples/ipython.svg">
1515
</p>
1616

1717
## htop.svg
1818
<p align="center">
19-
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.3.0/examples/htop.svg">
19+
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.4.0/examples/htop.svg">
2020
</p>
2121

2222
## unittest.svg
2323
<p align="center">
24-
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.3.0/examples/unittest.svg">
24+
<img src="https://cdn.rawgit.com/nbedos/termtosvg/0.4.0/examples/unittest.svg">
2525
</p>

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
setup(
66
name='termtosvg',
7-
version='0.3.0',
7+
version='0.4.0',
8+
licence='BSD 3-clause license',
9+
author='Nicolas Bedos',
810
description='Record terminal sessions as SVG animations',
911
long_description='A Linux terminal recorder written in Python '
1012
'which renders your command line sessions as '

termtosvg/config.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def conf_to_dict(configuration):
6464
"""Read a configuration string in INI format and return a dictionary
6565
6666
Raise a subclass of configparser.Error if parsing the configuration string fails
67-
Raise ValueError if the color theme is invalid
67+
Raise AsciiCastError if the color theme is invalid
6868
"""
6969
parser = configparser.ConfigParser(dict_type=CaseInsensitiveDict,
7070
comment_prefixes=(';',))
@@ -78,13 +78,16 @@ def conf_to_dict(configuration):
7878

7979
themes = [theme.lower() for theme in parser.sections() if theme.lower() != 'global']
8080
for theme_name in themes:
81-
fg = parser.get(theme_name, 'foreground', fallback='')
82-
bg = parser.get(theme_name, 'background', fallback='')
81+
fg = parser.get(theme_name, 'foreground', fallback=None)
82+
bg = parser.get(theme_name, 'background', fallback=None)
8383
palette = ':'.join(parser.get(theme_name, 'color{}'.format(i), fallback='')
8484
for i in range(16))
8585

86-
# This line raises AsciicastError if the color theme is invalid
87-
config_dict[theme_name] = asciicast.AsciiCastV2Theme(fg, bg, palette)
86+
try:
87+
config_dict[theme_name] = asciicast.AsciiCastV2Theme(fg, bg, palette)
88+
except asciicast.AsciiCastError:
89+
logger.error('Failed parsing color theme "{}"'.format(theme_name))
90+
raise
8891

8992
return config_dict
9093

termtosvg/data/termtosvg.ini

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
; --help'
2424

2525
font = DejaVu Sans Mono
26-
theme = solarized-dark
26+
theme = gjm8
2727

2828

2929
; All sections other than 'GLOBAL' define a color theme. You can add, delete
@@ -37,13 +37,27 @@ theme = solarized-dark
3737
; magenta, cyan, white)
3838
;
3939
; If color8 through color15 (bright ANSI colors) are defined, they are used by
40-
; termtosvg, otherwise color0 through color7 are used as a replacement
40+
; termtosvg to display bold characters as a replacement for color0 through
41+
; color7.
4142
;
4243
; All color values must be in #rrggbb format
4344
;
44-
; Default colors themes come from the base16-xresources projet
45+
; Default color themes come mostly from the base16-xresources projet
4546
; https://github.com/chriskempson/base16-xresources
4647

48+
[gjm8]
49+
; Source: https://terminal.sexy/
50+
foreground = #c5c5c5
51+
background = #1c1c1c
52+
color0 = #1c1c1c
53+
color1 = #ff005b
54+
color2 = #cee318
55+
color3 = #ffe755
56+
color4 = #048ac7
57+
color5 = #833c9f
58+
color6 = #0ac1cd
59+
color7 = #e5e5e5
60+
4761
[circus]
4862
; Authors: Stephan Boyer (https://github.com/stepchowfun) and Esther Wang
4963
foreground = #a7a7a7

0 commit comments

Comments
 (0)