Skip to content

Commit

Permalink
[+] Fix backward compat issue with #303
Browse files Browse the repository at this point in the history
  • Loading branch information
hykilpikonna committed Oct 23, 2024
1 parent c68dd7f commit d0f9119
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hyfetch/neofetch_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ class ColorAlignment:
@classmethod
def from_dict(cls, d: dict):
ca = from_dict(cls, d)
# Backward compatibility
if type(ca.custom_colors) is not dict:
if type(ca.custom_colors) is list:
ca.custom_colors = {i + 1: v for i, v in enumerate(ca.custom_colors)}
else:
ca.custom_colors = {}
# 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
Expand Down

0 comments on commit d0f9119

Please sign in to comment.