Mpdreamz / shellprogressbar

ShellProgressBar - display progress in your console application
MIT License
1.44k stars 134 forks source link

Change colour during progress #21

Closed GuerrillaCoder closed 4 years ago

GuerrillaCoder commented 6 years ago

Is there anyway to change the colour after progressbar is initiated? Would be cool to shift colours based on status of the task.

Atulin commented 6 years ago

Something like an array of colors added to options would be cool. Something like

Dictionary<double, ConsoleColor> colors = new Dictionary<double, ConsoleColor>
{
    {0.0, ConsoleColor.Red},
    {0.25, ConsoleColor.Yellow},
    {0.5, ConsoleColor.Green},
    {0.75, ConsoleColor.Cyan},
    {1.0, ConsoleColor.White}
};
ransagy commented 5 years ago

Definitely something i wanted to do just now - I wrote a little app to schedule CI/CD builds and report progress. When builds fail, i wanted to change their color.

Maybe make the color properties delegates that can decide colors on the fly? Shouldn't hurt performance as long as people don't do crazy things in them.

Another option is to allow the Tick method to specify new options to use.

marius-stanescu-archive360 commented 4 years ago

Yes, this would be nice. Any updates on this?

Mpdreamz commented 4 years ago

Took some time but this will go in to the next release

https://github.com/Mpdreamz/shellprogressbar/pull/58

pbar-changecolor

Thanks for the suggestion 😄