Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions aider/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ def get_parser(default_config_files, git_root):
default="#00cc00",
help="Set the color for user input (default: #00cc00)",
)
group.add_argument(
"--user-input-submitted-color",
default=None,
help="Set the color for user submitted input (default: #00cc00)",
)
group.add_argument(
"--tool-output-color",
default=None,
Expand Down
32 changes: 17 additions & 15 deletions aider/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ def __init__(
input=None,
output=None,
user_input_color="blue",
user_input_submitted_color=None,
tool_output_color=None,
tool_error_color="red",
tool_warning_color="#FFA500",
Expand Down Expand Up @@ -281,6 +282,9 @@ def __init__(
pretty = False

self.user_input_color = ensure_hash_prefix(user_input_color) if pretty else None
self.user_input_submitted_color = (
ensure_hash_prefix(user_input_submitted_color) if pretty else None
)
self.tool_output_color = ensure_hash_prefix(tool_output_color) if pretty else None
self.tool_error_color = ensure_hash_prefix(tool_error_color) if pretty else None
self.tool_warning_color = ensure_hash_prefix(tool_warning_color) if pretty else None
Expand Down Expand Up @@ -349,6 +353,7 @@ def __init__(
"output": self.output,
"lexer": PygmentsLexer(MarkdownLexer),
"editing_mode": self.editingmode,
"erase_when_done": True,
}
if self.editingmode == EditingMode.VI:
session_kwargs["cursor"] = ModalCursorShapeConfig()
Expand All @@ -375,6 +380,7 @@ def _validate_color_settings(self):
"""Validate configured color strings and reset invalid ones."""
color_attributes = [
"user_input_color",
"user_input_submitted_color",
"tool_output_color",
"tool_error_color",
"tool_warning_color",
Expand Down Expand Up @@ -507,11 +513,11 @@ def write_text(self, filename, content, max_retries=5, initial_delay=0.1):
raise

def rule(self):
if self.pretty:
style = dict(style=self.user_input_color) if self.user_input_color else dict()
self.console.rule(**style)
else:
print()
if not self.pretty:
return "\n"

columns = self.console.width
return "\n".join(["─" * columns, ""])

def interrupt_input(self):
if self.prompt_session and self.prompt_session.app:
Expand All @@ -529,18 +535,16 @@ def get_input(
abs_read_only_fnames=None,
edit_format=None,
):
self.rule()

# Ring the bell if needed
self.ring_bell()

rel_fnames = list(rel_fnames)
show = ""
show = self.rule()
if rel_fnames:
rel_read_only_fnames = [
get_rel_fname(fname, root) for fname in (abs_read_only_fnames or [])
]
show = self.format_files_for_input(rel_fnames, rel_read_only_fnames)
show += self.format_files_for_input(rel_fnames, rel_read_only_fnames)

prompt_prefix = ""
if edit_format:
Expand Down Expand Up @@ -650,9 +654,6 @@ def _(event):
if self.clipboard_watcher:
self.clipboard_watcher.start()

def get_continuation(width, line_number, is_soft_wrap):
return self.prompt_prefix

line = self.prompt_session.prompt(
show,
default=default,
Expand All @@ -662,8 +663,8 @@ def get_continuation(width, line_number, is_soft_wrap):
style=style,
key_bindings=kb,
complete_while_typing=True,
prompt_continuation=get_continuation,
)
self.display_user_input(show + line)
else:
line = input(show)

Expand Down Expand Up @@ -765,8 +766,8 @@ def log_llm_history(self, role, content):
self.llm_history_file = None

def display_user_input(self, inp):
if self.pretty and self.user_input_color:
style = dict(style=self.user_input_color)
if self.pretty and self.user_input_submitted_color:
style = dict(style=self.user_input_submitted_color)
else:
style = dict()

Expand Down Expand Up @@ -879,6 +880,7 @@ def is_valid_response(text):
style=style,
complete_while_typing=False,
)
self.display_user_input(question + res)
else:
res = input(question)
except EOFError:
Expand Down
1 change: 1 addition & 0 deletions aider/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ def get_io(pretty):
input=input,
output=output,
user_input_color=args.user_input_color,
user_input_submitted_color=args.user_input_submitted_color,
tool_output_color=args.tool_output_color,
tool_warning_color=args.tool_warning_color,
tool_error_color=args.tool_error_color,
Expand Down
3 changes: 3 additions & 0 deletions aider/website/assets/sample.aider.conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@
## Set the color for user input (default: #00cc00)
#user-input-color: "#00cc00"

## Set the color for user submitted input (default: None)
#user-input-submitted-color: "xxx"

## Set the color for tool output (default: None)
#tool-output-color: "xxx"

Expand Down
3 changes: 3 additions & 0 deletions aider/website/docs/config/dotenv.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ cog.outl("```")
## Set the color for user input (default: #00cc00)
#AIDER_USER_INPUT_COLOR=#00cc00

## Set the color for user submitted input (default: #00cc00)
#AIDER_USER_INPUT_SUBMITTED_COLOR=

## Set the color for tool output (default: None)
#AIDER_TOOL_OUTPUT_COLOR=

Expand Down
12 changes: 8 additions & 4 deletions aider/website/docs/config/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ usage: aider [-h] [--model] [--openai-api-key] [--anthropic-api-key]
[--restore-chat-history | --no-restore-chat-history]
[--llm-history-file] [--dark-mode] [--light-mode]
[--pretty | --no-pretty] [--stream | --no-stream]
[--user-input-color] [--tool-output-color]
[--tool-error-color] [--tool-warning-color]
[--assistant-output-color] [--completion-menu-color]
[--completion-menu-bg-color]
[--user-input-color] [--user-input-submitted-color]
[--tool-output-color] [--tool-error-color]
[--tool-warning-color] [--assistant-output-color]
[--completion-menu-color] [--completion-menu-bg-color]
[--completion-menu-current-color]
[--completion-menu-current-bg-color] [--code-theme]
[--show-diffs] [--git | --no-git]
Expand Down Expand Up @@ -329,6 +329,10 @@ Set the color for user input (default: #00cc00)
Default: #00cc00
Environment variable: `AIDER_USER_INPUT_COLOR`

### `--user-input-submitted-color VALUE`
Set the color for user submitted input (default: None)
Environment variable: `AIDER_USER_INPUT_SUBMITTED_COLOR`

### `--tool-output-color VALUE`
Set the color for tool output (default: None)
Environment variable: `AIDER_TOOL_OUTPUT_COLOR`
Expand Down
Loading