ctongfei / progressbar

Terminal-based progress bar for Java / JVM
http://tongfei.me/progressbar/
MIT License
1.06k stars 103 forks source link

How to change Text Color #162

Open Motasem-E opened 2 months ago

Motasem-E commented 2 months ago

Hi, I was able to change the colour of the progress bar, but not the text itself. Is there any way to do that? I'm using this setup:

ProgressBarBuilder pbb = ProgressBar.builder() .setStyle(ProgressBarStyle.builder() .colorCode((byte) 32) // the ANSI color code .block('█') .rightBracket("]") .leftBracket("[") .space(' ') .build() ).showSpeed(new DecimalFormat("#.##")) .setInitialMax(max) .setTaskName(name) .continuousUpdate() .setUnit("req", 1);

this.progressBar = pbb.build();

Thanks in advance!

ctongfei commented 1 month ago

Thanks! Right now the color code only controls the drawing part, not the text. You are welcome to create a PR to solve this issue!