This commit is contained in:
Matthias Metelka 2022-10-24 00:38:56 +02:00
parent 6ba476b8e1
commit 82f0548bdd

View file

@ -183,8 +183,15 @@ class ThemeManager:
def qcolor(self, colors: dict[str, str]) -> QColor:
"""Create QColor instance from CSS string for the current theme."""
if m:= re.match(r"rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d+\.*\d+?)\)", self.var(colors)):
return QColor(int(m.group(1)), int(m.group(2)), int(m.group(3)), 255 * float(m.group(4)))
if m := re.match(
r"rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d+\.*\d+?)\)", self.var(colors)
):
return QColor(
int(m.group(1)),
int(m.group(2)),
int(m.group(3)),
255 * float(m.group(4)),
)
return QColor(self.var(colors))
def _determine_night_mode(self) -> bool: