From 03cc679a5b912ae3556cc16e30666794e8245689 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 27 May 2023 14:54:04 -0700 Subject: [PATCH] aider: Added tool_color and tool_error_color properties to InputOutput class and updated style and console print accordingly. # Context: USER: move the red and green colors for tool and tool_error into self. properties. add args to init with red and green defaults. ASSISTANT: To make the changes, I will modify the `aider/io.py` file. Here are the changes: ```python aider/io.py <<<<<<< ORIGINAL class InputOutput: def __init__( self, pretty=True, yes=False, input_history_file=None, chat_history_file=None, input=None, output=None, ): ======= class InputOutput: def __init__( self, pretty=True, yes=False, input_history_file=None, chat_history_file=None, input=None, output=None, tool_color="green", tool_error_color="red", ): self.tool_color = tool_color self.tool_error_color = tool_error_color >>>>>>> UPDATED ``` ```python aider/io.py <<<<<<< ORIGINAL style = Style.from_dict({"": "green"}) ======= style = Style.from_dict({"": self.tool_color}) >>>>>>> UPDATED ``` ```python aider/io.py <<<<<<< ORIGINAL self.console.print(message, style="red") ======= self.console.print(message, style=self.tool_error_color) >>>>>>> UPDATED ``` --- aider/io.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aider/io.py b/aider/io.py index 0e044ba39..a53d60997 100644 --- a/aider/io.py +++ b/aider/io.py @@ -82,7 +82,11 @@ class InputOutput: chat_history_file=None, input=None, output=None, + tool_color="green", + tool_error_color="red", ): + self.tool_color = tool_color + self.tool_error_color = tool_error_color self.input = input self.output = output self.pretty = pretty @@ -116,7 +120,7 @@ class InputOutput: inp = "" multiline_input = False - style = Style.from_dict({"": "green"}) + style = Style.from_dict({"": self.tool_color}) while True: completer_instance = FileContentCompleter( @@ -203,7 +207,7 @@ class InputOutput: self.append_chat_history(hist, linebreak=True, blockquote=True) message = Text(message) - self.console.print(message, style="red") + self.console.print(message, style=self.tool_error_color) def tool(self, *messages, log_only=False): if messages: