package progress
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=3dfd00bd4def773239159b17781d02fdbfd8ea191801681a94aa0a5be1d06b7c
sha512=fd64ff8a819b2db2460c06b7fbd5663e2a1941f9e2d4e9b921a3d5f24509fe3be543521fbe1bb6baedad9f62b579aae933efac3903db03a27385233f5461f09c
doc/progress.engine/Progress_engine/Make/Line/Bar_style/index.html
Module Line.Bar_styleSource
The type of progress bar style specifications.
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
v 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.