add text_fill option

This commit is contained in:
2026-05-15 20:49:41 +01:00
parent 83467531b0
commit bad309b2f7
2 changed files with 4 additions and 1 deletions

View File

@@ -29,3 +29,4 @@ command = [ "python", "./res/pdweather.py" ]
font = "./res/curie.bdf"
text_filters = [ "lowercase" ]
text_offset = [45, 4]
text_fill = [255, 255, 255] # your template image must have alpha channel to use alpha

View File

@@ -44,7 +44,9 @@ def generate(config):
elif filter == "uppercase":
text = text.upper()
draw.text(config.get('text_offset', [0, 0]), text, font=font, fill=(255, 255, 255, 255))
fill = config.get('text_fill')
fill = tuple(fill) if fill else None
draw.text(config.get('text_offset', [0, 0]), text, font=font, fill=fill)
img.save(config['output'], save_all=True)