@@ -41,8 +41,8 @@ class ProgressBar:
4141
4242 def __init__ (self , * args , width : int = None , show_percentage : bool = True , prefix : str = '|' , suffix : str = '|' ,
4343 fill : str = '█' , empty : str = ' ' , format_ : str = None , style : str = '%' ,
44- new_line_when_complete : bool = True , colors : dict = None , logger : '_log21.Logger' = _logger ,
45- additional_variables : _Dict [str , _Any ] = None ):
44+ new_line_when_complete : bool = True , colors : dict = None , no_color : bool = False ,
45+ logger : '_log21.Logger' = _logger , additional_variables : _Dict [str , _Any ] = None ):
4646 """
4747 :param args: Prevents the use of positional arguments
4848 :param width: The width of the progress bar
@@ -55,6 +55,7 @@ def __init__(self, *args, width: int = None, show_percentage: bool = True, prefi
5555 :param style: The style that is used to format the progress bar
5656 :param new_line_when_complete: Whether to print a new line when the progress is complete or failed
5757 :param colors: The colors of the progress bar
58+ :param no_color: If True, removes the colors of the progress bar
5859 :param logger: The logger to use
5960 :param additional_variables: Additional variables to use in the format and their default values
6061 """
@@ -83,6 +84,8 @@ def __init__(self, *args, width: int = None, show_percentage: bool = True, prefi
8384 raise ValueError ('`empty` must be a single character' )
8485 if style not in ['%' , '{' ]:
8586 raise ValueError ('`style` must be either `%` or `{`' )
87+ if colors and no_color :
88+ raise PermissionError ('You cannot use `no_color` and `colors` parameters together!' )
8689 if additional_variables :
8790 if not isinstance (additional_variables , dict ):
8891 raise TypeError ('`additional_variables` must be a dictionary' )
@@ -126,6 +129,8 @@ def __init__(self, *args, width: int = None, show_percentage: bool = True, prefi
126129 if colors :
127130 for key , value in colors .items ():
128131 self .colors [key ] = value
132+ if no_color :
133+ self .colors = {name : '' for name in self .colors }
129134 self .logger = logger
130135 self .additional_variables = additional_variables
131136 self .i = 0
0 commit comments