remove ref to 9 cols themes

This commit is contained in:
eylles 2021-12-28 03:05:35 -06:00
parent 42efe31c95
commit 558b7e2796
No known key found for this signature in database
GPG Key ID: 87BB13678A662E19

View File

@ -16,10 +16,6 @@ def list_out():
for theme in list_themes()]
ligh_themes = [theme.name.replace(".json", "")
for theme in list_themes(dark=False)]
dark9_themes = [theme.name.replace(".json", "")
for theme in list_themes(nine=True)]
ligh9_themes = [theme.name.replace(".json", "")
for theme in list_themes(dark=False,nine=True)]
user_themes = [theme.name.replace(".json", "")
for theme in list_themes_user()]
@ -37,14 +33,8 @@ def list_out():
print("\033[1;32mDark Themes\033[0m:")
print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t
for t in sorted(dark_themes)))
print("\033[1;32mDark9 Themes\033[0m:")
print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t
for t in sorted(dark9_themes)))
print("\033[1;32mLight Themes\033[0m:")
print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t
for t in sorted(ligh_themes)))
print("\033[1;32mLight9 Themes\033[0m:")
print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t
for t in sorted(ligh_themes)))
@ -55,11 +45,10 @@ def list_out():
print(" - random_user (select a random user theme)")
def list_themes(dark=True, nine=False):
def list_themes(dark=True):
"""List all installed theme files."""
dark = "dark" if dark else "light"
nine = "9" if nine else "16"
themes = os.scandir(os.path.join(MODULE_DIR, "colorschemes", dark, nine))
themes = os.scandir(os.path.join(MODULE_DIR, "colorschemes", dark))
return [t for t in themes if os.path.isfile(t.path)]
@ -102,7 +91,7 @@ def parse(theme_file):
return data
def get_random_theme(dark=True, nine=False):
def get_random_theme(dark=True):
"""Get a random theme file."""
themes = [theme.path for theme in list_themes(dark)]
random.shuffle(themes)
@ -116,17 +105,16 @@ def get_random_theme_user():
return themes[0]
def file(input_file, light=False, nine=False):
def file(input_file, light=False):
"""Import colorscheme from json file."""
util.create_dir(os.path.join(CONF_DIR, "colorschemes/light/"))
util.create_dir(os.path.join(CONF_DIR, "colorschemes/dark/"))
theme_name = ".".join((input_file, "json"))
bri = "light" if light else "dark"
full16 = "9" if nine else "16"
user_theme_file = os.path.join(CONF_DIR, "colorschemes", full16, bri, theme_name)
theme_file = os.path.join(MODULE_DIR, "colorschemes", full16, bri, theme_name)
user_theme_file = os.path.join(CONF_DIR, "colorschemes", bri, theme_name)
theme_file = os.path.join(MODULE_DIR, "colorschemes", bri, theme_name)
# Find the theme file.
if input_file in ("random", "random_dark"):
@ -158,11 +146,9 @@ def file(input_file, light=False, nine=False):
sys.exit(1)
def save(colors, theme_name, light=False, nine=False):
def save(colors, theme_name, light=False):
"""Save colors to a theme file."""
theme_file = theme_name + ".json"
theme_path = os.path.join(CONF_DIR, "colorschemes",
"9" if nine else "16",
"light" if light else "dark",
theme_file)
"light" if light else "dark", theme_file)
util.save_file_json(colors, theme_path)