Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6f48bc

Browse files
authored
solves #14901 illegible yellow string on yellow background issue (#15156)
2 parents 8635f71 + f63b408 commit c6f48bc

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

IPython/core/ultratb.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,8 +817,10 @@ def get_records(self, etb: TracebackType, context: int, tb_offset: int) -> Any:
817817
after = context // 2
818818
before = context - after
819819
if self.has_colors:
820-
base_style = theme_table[self._theme_name].as_pygments_style()
821-
style = stack_data.style_with_executing_node(base_style, self.tb_highlight)
820+
theme = theme_table[self._theme_name]
821+
base_style = theme.as_pygments_style()
822+
tb_highlight = theme.extra_style.get(Token.TbHighlight, self.tb_highlight)
823+
style = stack_data.style_with_executing_node(base_style, tb_highlight)
822824
formatter = Terminal256Formatter(style=style)
823825
else:
824826
formatter = None

IPython/utils/PyColorize.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def make_arrow(self, width: int) -> str:
138138
Token.PromptNum: "ansigreen bold",
139139
Token.OutPrompt: "ansibrightred",
140140
Token.OutPromptNum: "ansired bold",
141+
Token.TbHighlight: "ansiblack bg:ansiyellow",
141142
},
142143
)
143144

@@ -170,6 +171,7 @@ def make_arrow(self, width: int) -> str:
170171
Token.Name.Variable.Magic: "ansiblue",
171172
Token.Prompt: "ansigreen",
172173
Token.OutPrompt: "ansired",
174+
Token.TbHighlight: "ansiblack bg:ansiyellow",
173175
}
174176

175177

@@ -227,6 +229,7 @@ def make_arrow(self, width: int) -> str:
227229
Token.PromptNum: "ansiblue bold",
228230
Token.OutPrompt: "ansibrightred",
229231
Token.OutPromptNum: "ansired bold",
232+
Token.TbHighlight: "ansired bg:ansiyellow",
230233
},
231234
)
232235

@@ -268,6 +271,7 @@ def make_arrow(self, width: int) -> str:
268271
Token.PromptNum: "ansiblue bold",
269272
Token.OutPrompt: "ansibrightred",
270273
Token.OutPromptNum: "ansired bold",
274+
Token.TbHighlight: f"bg:{PRIDE_YELLOW}",
271275
},
272276
symbols={"arrow_body": "\u2500", "arrow_head": "\u25b6", "top_line": "\u2500"},
273277
)
@@ -368,6 +372,7 @@ def make_arrow(self, width: int) -> str:
368372
Token.PromptNum: f"{GRUVBOX_PROMPT_NUM} bold",
369373
Token.OutPrompt: GRUVBOX_OUT_PROMPT,
370374
Token.OutPromptNum: f"{GRUVBOX_OUT_PROMPT_NUM} bold",
375+
Token.TbHighlight: f"bg:{GRUVBOX_TOPLINE}",
371376
},
372377
symbols={"arrow_body": "\u2500", "arrow_head": "\u25b6", "top_line": "\u2500"},
373378
)

0 commit comments

Comments
 (0)