mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
refactor: simplify _get_style method in InputOutput class
This commit is contained in:
parent
d3908ca971
commit
ede3cbb372
1 changed files with 20 additions and 14 deletions
34
aider/io.py
34
aider/io.py
|
@ -251,26 +251,32 @@ class InputOutput:
|
|||
else:
|
||||
self.console = Console(force_terminal=False, no_color=True) # non-pretty
|
||||
|
||||
def _get_style(self, style_dict=None):
|
||||
if style_dict is None:
|
||||
style_dict = {}
|
||||
if self.pretty and self.user_input_color:
|
||||
def _get_style(self):
|
||||
style_dict = {}
|
||||
if not self.pretty:
|
||||
return Style.from_dict(style_dict)
|
||||
|
||||
if self.user_input_color:
|
||||
style_dict.setdefault("", self.user_input_color)
|
||||
style_dict.update(
|
||||
{
|
||||
"pygments.literal.string": f"bold italic {self.user_input_color}",
|
||||
"completion-menu": (
|
||||
f"bg:{self.completion_menu_bg_color} {self.completion_menu_color}"
|
||||
),
|
||||
"completion-menu.completion.current": (
|
||||
f"bg:{self.completion_menu_current_bg_color} "
|
||||
f"{self.completion_menu_current_color}"
|
||||
),
|
||||
}
|
||||
)
|
||||
return Style.from_dict(style_dict)
|
||||
else:
|
||||
return {}
|
||||
|
||||
style_dict.update(
|
||||
{
|
||||
"completion-menu": (
|
||||
f"bg:{self.completion_menu_bg_color} {self.completion_menu_color}"
|
||||
),
|
||||
"completion-menu.completion.current": (
|
||||
f"bg:{self.completion_menu_current_bg_color} "
|
||||
f"{self.completion_menu_current_color}"
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
return Style.from_dict(style_dict)
|
||||
|
||||
def read_image(self, filename):
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue