Browse Source

Make background of png images configurable (#200)

pull/601/head
Igor Chubin 5 years ago
parent
commit
5ef9e3eddb
2 changed files with 7 additions and 2 deletions
  1. +6
    -2
      lib/fmt/png.py
  2. +1
    -0
      share/help.txt

+ 6
- 2
lib/fmt/png.py View File

@ -163,7 +163,7 @@ def _load_emojilib():
emojilib = {}
for filename in glob.glob("share/emoji/*.png"):
character = os.path.basename(filename)[:-4]
character = os.path.basename(filename)[:-3]
emojilib[character] = \
Image.open(filename).resize((CHAR_HEIGHT, CHAR_HEIGHT))
return emojilib
@ -183,7 +183,11 @@ def _gen_term(buf, graphemes, options=None):
cols = max(len(x) for x in buf)
rows = len(buf)
image = Image.new('RGB', (cols * CHAR_WIDTH, rows * CHAR_HEIGHT))
bg_color = 0
if "background" in options:
bg_color = _color_mapping(options["background"])
image = Image.new('RGB', (cols * CHAR_WIDTH, rows * CHAR_HEIGHT), color=bg_color)
buf = buf[-ROWS:]


+ 1
- 0
share/help.txt View File

@ -42,6 +42,7 @@ PNG options:
p # add frame around the output
t # transparency 150
transparency=... # transparency from 0 to 255 (255 = not transparent)
background=... # background color in form RRGGBB, e.g. 00aaaa
Options can be combined:


Loading…
Cancel
Save