diff --git a/hyfetch/main.py b/hyfetch/main.py index 41e16ac1..034d8c9e 100755 --- a/hyfetch/main.py +++ b/hyfetch/main.py @@ -247,7 +247,7 @@ def select_lightness(): # Random color schemes pis = list(range(len(_prs.unique_colors().colors))) - slots = list(set(re.findall('(?<=\\${c)[0-9](?=})', asc))) + slots = list(set(map(int, re.findall('(?<=\\${c)[0-9](?=})', asc)))) while len(pis) < len(slots): pis += pis perm = {p[:len(slots)] for p in permutations(pis)} diff --git a/hyfetch/neofetch_util.py b/hyfetch/neofetch_util.py index 2a17fedc..106edcf3 100644 --- a/hyfetch/neofetch_util.py +++ b/hyfetch/neofetch_util.py @@ -129,7 +129,10 @@ class ColorAlignment: @classmethod def from_dict(cls, d: dict): - return from_dict(cls, d) + ca = from_dict(cls, d) + # Fixup: Keys must json serialize as str, so we convert them back to int. + ca.custom_colors = {int(k): v for k, v in ca.custom_colors.items()} + return ca def recolor_ascii(self, asc: str, preset: ColorProfile) -> str: """