Update README.md

This commit is contained in:
Pranav
2019-12-17 21:41:44 -06:00
committed by GitHub
parent 34813c8642
commit c5969eefe4

View File

@@ -34,31 +34,7 @@
# Progress bar # Progress bar
To introduce a progress bar in your application, include `indicators/progress_bar.hpp` and create a `ProgressBar` object. To introduce a progress bar in your application, include `indicators/progress_bar.hpp` and create a `ProgressBar` object. Here's the general structure of a progress bar:
```cpp
#include <indicators/progress_bar.hpp>
int main() {
indicators::ProgressBar bar;
// Configure the bar
bar.set_bar_width(50);
bar.start_bar_with("[");
bar.fill_bar_progress_with("=");
bar.lead_bar_progress_with(">");
bar.fill_bar_remainder_with(" ");
bar.end_bar_with("]");
bar.set_postfix_text("Getting started");
bar.set_foreground_color(indicators::Color::GREEN);
// Update bar state
return 0;
}
```
Here's the general structure of a progress bar:
``` ```
{prefix} {start} {fill} {lead} {remaining} {end} {percentage} [{elapsed}<{remaining}] {postfix} {prefix} {start} {fill} {lead} {remaining} {end} {percentage} [{elapsed}<{remaining}] {postfix}
@@ -73,6 +49,10 @@ From application-level code, there are two ways in which you can update this pro
You can update the progress bar using `bar.tick()` which increments progress by exactly `1%`. You can update the progress bar using `bar.tick()` which increments progress by exactly `1%`.
<p align="center">
<img src="img/progress_bar_tick.gif"/>
</p>
```cpp ```cpp
#include <indicators/progress_bar.hpp> #include <indicators/progress_bar.hpp>
#include <thread> #include <thread>