Fix transparency problem with alert icons

This commit is contained in:
nemunaire 2022-08-14 18:41:51 +02:00
parent c674f97f50
commit 6b7e277f84
2 changed files with 2 additions and 2 deletions

View File

@ -94,7 +94,7 @@ class AlertsModule:
if alert["icon"] is not None: if alert["icon"] is not None:
if callable(alert["icon"]): if callable(alert["icon"]):
icon_img = alert["icon"](size=int(font_size*self.icon_size/16)) icon_img = alert["icon"](size=int(font_size*self.icon_size/16))
image.paste(icon_img, (int(self.icon_size / 2 - font_size*self.icon_size/32), align), icon_img) image.paste(icon_img, (int(self.icon_size / 2 - font_size*self.icon_size/32), align))
else: else:
color_img = Image.new('RGB', (self.icon_size, self.icon_size), "#fff") color_img = Image.new('RGB', (self.icon_size, self.icon_size), "#fff")
icon_img = Image.open("icons/" + alert["icon"]).resize((self.icon_size, self.icon_size)) icon_img = Image.open("icons/" + alert["icon"]).resize((self.icon_size, self.icon_size))

View File

@ -130,7 +130,7 @@ class RATPWeatherModule:
def alert_icon(mode, line): def alert_icon(mode, line):
def icon(size=64): def icon(size=64):
image = Image.new('RGBA', (size, size), '#0000') image = Image.new('RGB', (size, size), '#000')
white = Image.new('RGB', (int(size / 2), int(size / 2)), '#fff') white = Image.new('RGB', (int(size / 2), int(size / 2)), '#fff')
mode_icon = Image.open("icons/" + mode + ".png").resize((int(size/2), int(size/2))) mode_icon = Image.open("icons/" + mode + ".png").resize((int(size/2), int(size/2)))