From 5b8eeb127f3d56352bda49fe8f3eb2e1f652ea0c Mon Sep 17 00:00:00 2001 From: coolkiid <73600915+coolkiid@users.noreply.github.com> Date: Sat, 5 Oct 2024 19:15:19 +0800 Subject: [PATCH] fix: add type conversion to fix wrong argument type issue: #480 --- app/common/style_sheet.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/common/style_sheet.py b/app/common/style_sheet.py index e2fdc00..523fd5c 100644 --- a/app/common/style_sheet.py +++ b/app/common/style_sheet.py @@ -230,9 +230,11 @@ def __getStyleSheetColor(color: QColor): r, g, b, a = color.getRgb() f1, f2 = 1.1, 0.9 - r1, g1, b1 = min(r * f1, 255), min(g * f1, 255), min(b * f1, 255) - r2, g2, b2 = min(r * f2, 255), min(g * f2, 255), min(b * f2, 255) - a1, a2 = min(a + 25, 255), min(a + 50, 255) + + type_conversion = lambda x: int(x) + r1, g1, b1 = map(type_conversion, [min(r * f1, 255), min(g * f1, 255), min(b * f1, 255)]) + r2, g2, b2 = map(type_conversion, [min(r * f2, 255), min(g * f2, 255), min(b * f2, 255)]) + a1, a2 = map(type_conversion, [min(a + 25, 255), min(a + 50, 255)]) c1 = QColor.fromRgb(r1, g1, b1, a1) c2 = QColor.fromRgb(r2, g2, b2, a2)