Skip to content

Commit

Permalink
Change default font colors to be suitable for both white and black te…
Browse files Browse the repository at this point in the history
…rminal background (#1084)
  • Loading branch information
dinanz authored Apr 24, 2023
1 parent 03c6a8c commit 984bd72
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions jarviscli/CmdInterpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def say(self, text, color="", speak=True):
and talk when sound is enable.
:param text: the text to print (or talk)
:param color: for text - use colorama (https://pypi.org/project/colorama/)
e.g. Fore.BLUE
e.g. Fore.CYAN
:param speak: False-, if text shouldn't be spoken even if speech is enabled
"""
print(color + text + Fore.RESET, flush=True)
Expand Down Expand Up @@ -275,7 +275,7 @@ def incorrect_option(self):
A function to notify the user that an incorrect option
has been entered and prompting him to enter a correct one
"""
self.say("Oops! Looks like you entered an incorrect option", Fore.RED)
self.say("Oops! Looks like you entered an incorrect option", Fore.MAGENTA)
self.say("Look at the options once again:", Fore.GREEN)


Expand All @@ -290,7 +290,7 @@ def try_do(self, s):
if self._api.is_spinner_running():
self.spinner_stop("It seems some error has occured")
print(
Fore.RED
Fore.MAGENTA
+ "Some error occurred, please open an issue on github!")
print("Here is error:")
print('')
Expand Down Expand Up @@ -346,8 +346,8 @@ def __init__(
self.speech = create_voice(
self, gtts_status, rate=self.speech_rate)
except Exception as e:
self.say("Voice not supported", Fore.RED)
self.say(str(e), Fore.RED)
self.say("Voice not supported", Fore.MAGENTA)
self.say(str(e), Fore.MAGENTA)

self.fixed_responses = {"what time is it": "clock",
"where am i": "pinpoint",
Expand All @@ -369,14 +369,14 @@ def _init_plugin_info(self):
plugin_status_formatter = {
"disabled": len(self._plugin_manager.get_disabled()),
"enabled": self._plugin_manager.get_number_plugins_loaded(),
"red": Fore.RED,
"blue": Fore.BLUE,
"magenta": Fore.MAGENTA,
"cyan": Fore.CYAN,
"reset": Fore.RESET
}

plugin_status = "{red}{enabled} {blue}plugins loaded"
plugin_status = "{magenta}{enabled} {cyan}plugins loaded"
if plugin_status_formatter['disabled'] > 0:
plugin_status += " {red}{disabled} {blue}plugins disabled. More information: {red}status\n"
plugin_status += " {magenta}{disabled} {cyan}plugins disabled. More information: {magenta}status\n"
plugin_status += Fore.RESET

self.first_reaction_text += plugin_status.format(
Expand Down Expand Up @@ -428,7 +428,7 @@ def close(self):
if self._api.is_spinner_running():
self._api.spinner_stop('Some error has occured')

self.say("Goodbye, see you later!", Fore.RED)
self.say("Goodbye, see you later!", Fore.MAGENTA)
self.scheduler.stop_all()
sys.exit()

Expand All @@ -438,7 +438,7 @@ def execute_once(self, command):

def error(self):
"""Jarvis let you know if an error has occurred."""
self.say("I could not identify your command...", Fore.RED)
self.say("I could not identify your command...", Fore.MAGENTA)

def interrupt_handler(self, signal, frame):
"""Closes Jarvis on SIGINT signal. (Ctrl-C)"""
Expand Down Expand Up @@ -469,7 +469,7 @@ def do_help(self, arg):
headerString = "These are valid commands for Jarvis"
formatString = "Format: command ([aliases for command])"
self.say(headerString)
self.say(formatString, Fore.BLUE)
self.say(formatString, Fore.CYAN)
pluginDict = self._plugin_manager.get_plugins()
uniquePlugins = {}
for key in pluginDict.keys():
Expand Down
14 changes: 7 additions & 7 deletions jarviscli/Jarvis.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ class Jarvis(CmdInterpreter, object):
# variable used at Breakpoint #1.
# allows Jarvis say "Hi", only at the first interaction.
first_reaction_text = ""
first_reaction_text += Fore.BLUE + \
first_reaction_text += Fore.CYAN + \
'Jarvis\' sound is by default disabled.' + Fore.RESET
first_reaction_text += "\n"
first_reaction_text += Fore.BLUE + 'In order to let Jarvis talk out loud type: '
first_reaction_text += Fore.RESET + Fore.RED + 'enable sound' + Fore.RESET
first_reaction_text += Fore.CYAN + 'In order to let Jarvis talk out loud type: '
first_reaction_text += Fore.RESET + Fore.MAGENTA + 'enable sound' + Fore.RESET
first_reaction_text += "\n"
first_reaction_text += Fore.BLUE + \
first_reaction_text += Fore.CYAN + \
"Type 'help' for a list of available actions." + Fore.RESET
first_reaction_text += "\n"
prompt = (
Fore.RED
Fore.MAGENTA
+ "{} Hi, what can I do for you?\n".format(PROMPT_CHAR)
+ Fore.RESET)

Expand Down Expand Up @@ -79,7 +79,7 @@ def _rel_path_fix(self, dirs):

def default(self, data):
"""Jarvis let's you know if an error has occurred."""
print_say("I could not identify your command...", self, Fore.RED)
print_say("I could not identify your command...", self, Fore.MAGENTA)

def precmd(self, line):
"""Hook that executes before every command."""
Expand All @@ -106,7 +106,7 @@ def postcmd(self, stop, line):
"""Hook that executes after every command."""
if self.first_reaction:
self.prompt = (
Fore.RED
Fore.MAGENTA
+ "{} What can I do for you?\n".format(PROMPT_CHAR)
+ Fore.RESET)
self.first_reaction = False
Expand Down

0 comments on commit 984bd72

Please sign in to comment.