Fix ColorAlignment.custom_colors.keys() / slots type mismatch
This commit is contained in:
parent
2a01c50aa6
commit
45347e0714
2 changed files with 5 additions and 2 deletions
|
@ -247,7 +247,7 @@ def create_config() -> Config:
|
||||||
|
|
||||||
# Random color schemes
|
# Random color schemes
|
||||||
pis = list(range(len(_prs.unique_colors().colors)))
|
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):
|
while len(pis) < len(slots):
|
||||||
pis += pis
|
pis += pis
|
||||||
perm = {p[:len(slots)] for p in permutations(pis)}
|
perm = {p[:len(slots)] for p in permutations(pis)}
|
||||||
|
|
|
@ -129,7 +129,10 @@ class ColorAlignment:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls, d: dict):
|
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:
|
def recolor_ascii(self, asc: str, preset: ColorProfile) -> str:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue