Skip to content

Commit

Permalink
add color theme
Browse files Browse the repository at this point in the history
Signed-off-by: matthias.gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Nov 29, 2024
1 parent 973d48c commit 5cbf2b0
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions osc_tui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,27 @@ def do_search(array, lookup_list: List[str], name_as_tag=False, az=False, state_


class App(osc_npyscreen.NPSAppManaged):
def txtColotToTheme(self, color):
if color == "Default":
return osc_npyscreen.Themes.DefaultTheme
elif color == "Elegant":
return osc_npyscreen.Themes.ElegantTheme
elif color == "Colorful":
return osc_npyscreen.Themes.ColorfulTheme
elif color == "BlackOnWhite":
return osc_npyscreen.Themes.BlackOnWhiteTheme
elif color == "TransparentDark":
return osc_npyscreen.Themes.TransparentThemeDarkText
elif color == "TransparentLight":
return osc_npyscreen.Themes.TransparentThemeLightText
return osc_npyscreen.Themes.DefaultTheme

def __init__(self, color):
self.colorTheme = self.txtColotToTheme(color)
super().__init__()

def onStart(self):
osc_npyscreen.setTheme(osc_npyscreen.Themes.DefaultTheme)
osc_npyscreen.setTheme(self.colorTheme)
self.addForm("MAIN", profileSelector.ProfileSelector,
name="osc-tui")

Expand All @@ -109,12 +128,14 @@ def help():
-v, --version: print version
-h, --help: print this help
--profile [PROFILE] select default profile, list all profiles if PROFILE not found
--color-theme [THEME] select default color theme
--mode MODE select default mode
--ascii-logo use ascii for logo
"""
)

def main():
color=None
argc = len(sys.argv)
argv = sys.argv

Expand All @@ -140,6 +161,12 @@ def main():
""")
return 1
profileSelector.MODE = argv[i]
elif a == "--color-theme":
i += 1
if i == argc:
print("--color-theme require one of those theme: Default, Elegant, Colorful, BlackOnWhite, TransparentDark, TransparentLight")
return 0;
color=argv[i]
elif a == "--profile":
i += 1
if i == argc:
Expand All @@ -165,7 +192,7 @@ def main():

try:
guiRules.parse()
APP = App()
APP = App(color)
APP.run()
except KeyboardInterrupt:
kill_threads()
Expand Down

0 comments on commit 5cbf2b0

Please sign in to comment.