From 167cf5fc40800fdcf34a502d7a7a96fc7126e25c Mon Sep 17 00:00:00 2001 From: imarkoff Date: Sat, 28 Jan 2023 09:29:19 +0200 Subject: [PATCH] Simplified theme mode option --- README.md | 10 +++++----- install.py | 40 ++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 998d942..a8ed6aa 100644 --- a/README.md +++ b/README.md @@ -67,13 +67,13 @@ python install.py #### Theme mode | Option | Secondary option | Description | | ------------ | ------------ | ------------ | -| | --light | light theme only | -| | --dark | dark theme only | +| | light | light theme only | +| | dark | dark theme only | #### Examples | Command | Description | | ------------ | ------------ | | -A | Install all accent colors with light & dark mode | -| --all --dark | Install all accent colors with dark mode only | -| --purple --light | Install purple accent color with light mode only | +| --all dark | Install all accent colors with dark mode only | +| --purple light | Install purple accent color with light mode only | | --hue 180 | Install hue=180 accent color with light & dark mode | -| --hue 145 coldgreen --dark | Install hue=145 coldgreen accent color with dark mode only | +| --hue 145 coldgreen dark | Install hue=145 coldgreen accent color with dark mode only | diff --git a/install.py b/install.py index ec7f691..097e9eb 100644 --- a/install.py +++ b/install.py @@ -37,15 +37,15 @@ def print_help(): "--hue\tHUE_DEGREE\tTHEME_NAME[optional]\tTHEME_MODE[optional]\nGenerate theme from Hue prompt [0 - 360]") print("\nTheme mode:\n" - "\t--light light theme only\n" - "\t--dark dark theme only") + "\tlight light theme only\n" + "\tdark dark theme only") print("\nExample:\n" "-A\t\t\tInstall all accent colors with light & dark mode\n" - "--all --dark\t\tInstall all accent colors with dark mode only\n" - "--purple --light\tInstall purple accent color with light mode only\n" + "--all dark\t\tInstall all accent colors with dark mode only\n" + "--purple light\t\tInstall purple accent color with light mode only\n" "--hue 180\t\tInstall hue=180 accent color with light & dark mode\n" - "--hue 140 coldgreen --dark\tInstall hue=140 coldgreen accent color with dark mode only") + "--hue 140 coldgreen dark\tInstall hue=140 coldgreen accent color with dark mode only") def destination_return(path_name, theme_mode): @@ -149,35 +149,35 @@ def install_all(theme_mode): def main(): - user_input = input("\n>>> ").split() + user_input = input("\n>>> ").lower().split() userInputLength = len(user_input) # this part is a piece of sh.... # i'll rewrite it later match user_input[0]: - case "-A" | "--all": - if userInputLength == 1 or user_input[1] != "--light" and user_input[1] != "--dark": + case "-a" | "--all": + if userInputLength == 1 or user_input[1] != "light" and user_input[1] != "dark": install_all("light") install_all("dark") else: - install_all(user_input[1][2:len(user_input[1])]) + install_all(user_input[1]) case "--red" | "--pink" | "--purple" | "--blue" | "--green" | "--yellow": path_name = user_input[0][2:len(user_input[0])] hue = colors["colors"][path_name]["h"] - if userInputLength == 1 or user_input[1] != "--light" and user_input[1] != "--dark": + if userInputLength == 1 or user_input[1] != "light" and user_input[1] != "dark": install_color(hue, path_name, "light") install_color(hue, path_name, "dark") else: - install_color(hue, path_name, user_input[1][2:len(user_input[1])]) + install_color(hue, path_name, user_input[1]) case "--gray" | "--grey": - if userInputLength == 1 or user_input[1] != "--light" and user_input[1] != "--dark": + if userInputLength == 1 or user_input[1] != "light" and user_input[1] != "dark": install_color(0, "gray", "light", sat=0) install_color(0, "gray", "dark", sat=0) else: - install_color(0, "gray", user_input[1][2:len(user_input[1])], sat=0) + install_color(0, "gray", user_input[1], sat=0) case "--hue": if not user_input[1].isdigit(): @@ -188,20 +188,20 @@ def main(): print("Incorrect hue degree. The integer must be from 0 to 360.", end="") main() - elif userInputLength == 2 and user_input[2] != "--light" and user_input[2] != "--dark": + elif userInputLength == 2 and user_input[2] != "light" and user_input[2] != "dark": install_color(int(user_input[1]), user_input[1], "light") install_color(int(user_input[1]), user_input[1], "dark") - elif userInputLength == 2 and user_input[2] == "--light" or \ - userInputLength == 2 and user_input[2] == "--dark": - install_color(int(user_input[1]), user_input[1], user_input[2][2:len(user_input[2])]) + elif userInputLength == 2 and user_input[2] == "light" or \ + userInputLength == 2 and user_input[2] == "dark": + install_color(int(user_input[1]), user_input[1], user_input[2]) - elif userInputLength == 3 or user_input[3] != "--light" and user_input[3] != "--dark": + elif userInputLength == 3 or user_input[3] != "light" and user_input[3] != "dark": install_color(int(user_input[1]), user_input[2], "light") install_color(int(user_input[1]), user_input[2], "dark") - elif user_input[3] == "--light" or user_input[3] == "--dark": - install_color(int(user_input[1]), user_input[2], user_input[3][2:len(user_input[3])]) + elif user_input[3] == "light" or user_input[3] == "dark": + install_color(int(user_input[1]), user_input[2], user_input[3]) print_help()