Bläddra i källkod

[F] Fix incorrect coloring when the first color isn't ${c1}

Azalea (on HyDEV-Daisy) 2 år sedan
förälder
incheckning
bd5d76167e
2 ändrade filer med 6 tillägg och 5 borttagningar
  1. 4 4
      hyfetch/main.py
  2. 2 1
      hyfetch/neofetch_util.py

+ 4 - 4
hyfetch/main.py

@@ -284,16 +284,16 @@ 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 = len(set(re.findall('(?<=\\${c)[0-9](?=})', asc)))
-        while len(pis) < slots:
+        slots = list(set(re.findall('(?<=\\${c)[0-9](?=})', asc)))
+        while len(pis) < len(slots):
             pis += pis
             pis += pis
-        perm = {p[:slots] for p in permutations(pis)}
+        perm = {p[:len(slots)] for p in permutations(pis)}
         random_count = ascii_per_row * ascii_rows - len(arrangements)
         random_count = ascii_per_row * ascii_rows - len(arrangements)
         if random_count > len(perm):
         if random_count > len(perm):
             choices = perm
             choices = perm
         else:
         else:
             choices = random.sample(perm, random_count)
             choices = random.sample(perm, random_count)
-        choices = [{i + 1: n for i, n in enumerate(c)} for c in choices]
+        choices = [{slots[i]: n for i, n in enumerate(c)} for c in choices]
         arrangements += [(f'random{i}', ColorAlignment('custom', r)) for i, r in enumerate(choices)]
         arrangements += [(f'random{i}', ColorAlignment('custom', r)) for i, r in enumerate(choices)]
         asciis = [[*ca.recolor_ascii(asc, _prs).split('\n'), k.center(asc_width)] for k, ca in arrangements]
         asciis = [[*ca.recolor_ascii(asc, _prs).split('\n'), k.center(asc_width)] for k, ca in arrangements]
 
 

+ 2 - 1
hyfetch/neofetch_util.py

@@ -288,8 +288,9 @@ def get_fore_back(distro: str | None = None) -> tuple[int, int] | None:
         distro = GLOBAL_CFG.override_distro
         distro = GLOBAL_CFG.override_distro
     if not distro:
     if not distro:
         distro = get_distro_name().lower()
         distro = get_distro_name().lower()
+    distro = distro.lower()
     for k, v in fore_back.items():
     for k, v in fore_back.items():
-        if distro.startswith(k.lower()):
+        if distro == k.lower():
             return v
             return v
     return None
     return None