package progress
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=7f87f0597363928c45ba859ae5a1430f6aa3c29e251ff1a53cf786ed0e045961
sha512=45dee4fe2ae0b7fc3ca675f6e854d738873eb608ef9155ea5d7edac4639c183ae1f512847a1b43bdfc1f4c459e7d5b44d03ee809455797e680f890b33d531367
doc/progress.engine/Progress_engine/Make/Line/Using_int64/Bar_style/index.html
Module Using_int64.Bar_styleSource
The style used by bar ~style:`ASCII (which is the default). Generates bars of the form [######---].
utf8 is the style used by bar ~style:`UTF8. Uses the UTF-8 block element characters (U+2588–U+258F) for progress stages, and a box-drawing character (U+2502) for delimiters.
Custom styles
val v :
?delims:(string * string) ->
?color:Color.t ->
?color_empty:Color.t ->
string list ->
Bar_style.tv stages is a bar that uses the given string stages to render progress. The first stage is interpreted as a "full" segment, with subsequent stages denoting progressively less-full segments until a final "empty" stage (which is implicitly a space if only one stage is provided).
The optional parameters are as follows:
?delims: a pair of left and right delimiters used to wrap the body of the progress bar;?color: the color of non-empty segments (including the in-progress one);?color_empty: the color of empty segments.
Examples
v [ "#" ]renders like "#######";v [ "="; ">"; " " ]renders like "======>";v [ "4"; "3"; "2"; "1"; "0" ]renders like "444444410000";- ... see
examples/bar_styles.mlin the source repository for more.
Specifics
Each segment of a rendering progress bar is in one of three states: full, empty or in-progress. At any given time, either the bar is entirely full or or there is exactly one in-progress segment. Given the style v [s1; s2; ... sN], these states are rendered as follows:
- full: rendered as
s1; - empty: rendered as
sNifN >= 1, otherwise' '; - in-progress: if
N <= 1, then equivalent to the empty state. Otherwise, the intermediate stagess2,s3, ...s{N-1}denote decreasing progress. For example, if there are four intermediate stages (N = 6) thens2is used for progress in the range[0, 25%),s3for[25%, 50%)etc.
For the progress bar to render within a fixed size, the user must ensure that each of the stages must have the same rendered width.