@@ -149,11 +149,10 @@ def __rich_console__(self, console: Console, options: ConsoleOptions) -> RenderR
149149class CustomBarColumn (BarColumn ):
150150 """Bar column that recolors on divergences and renders a separator marker."""
151151
152- def __init__ (self , * args , failing_color : str = "red" , ** kwargs ):
153- from matplotlib .colors import to_rgb
154-
155- self .failing_color = failing_color
156- self .failing_rgb = [int (x * 255 ) for x in to_rgb (self .failing_color )]
152+ def __init__ (self , * args , failing_style : Style | None = None , ** kwargs ):
153+ self .failing_style = (
154+ failing_style if failing_style is not None else Style .parse ("rgb(214,39,40)" )
155+ )
157156
158157 super ().__init__ (* args , ** kwargs )
159158
@@ -163,8 +162,8 @@ def __init__(self, *args, failing_color: str = "red", **kwargs):
163162 def callbacks (self , task : Task ):
164163 """Update bar color based on failure state."""
165164 if task .fields ["failing" ]:
166- self .complete_style = Style . parse ( "rgb({},{},{})" . format ( * self .failing_rgb ))
167- self .finished_style = Style . parse ( "rgb({},{},{})" . format ( * self .failing_rgb ))
165+ self .complete_style = self .failing_style
166+ self .finished_style = self .failing_style
168167 else :
169168 self .complete_style = self .default_complete_style
170169 self .finished_style = self .default_finished_style
@@ -264,7 +263,6 @@ def _create_progress_bar(
264263 CustomBarColumn (
265264 bar_width = None ,
266265 table_column = Column ("Progress" , ratio = 2 ),
267- failing_color = "tab:red" ,
268266 complete_style = Style .parse ("rgb(31,119,180)" ),
269267 finished_style = Style .parse ("rgb(31,119,180)" ),
270268 ),
0 commit comments