Line.Bar_style
val ascii : t
The style used by bar ~style:`ASCII
(which is the default). Generates bars of the form [######---]
.
val utf8 : t
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.
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.v [ "#" ]
renders like "#######
";v [ "="; ">"; " " ]
renders like "======>
";v [ "4"; "3"; "2"; "1"; "0" ]
renders like "444444410000
";examples/bar_styles.ml
in the source repository for more.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:
s1
;sN
if N >= 1
, otherwise ' '
;N <= 1
, then equivalent to the empty state. Otherwise, the intermediate stages s2
, s3
, ... s{N-1}
denote decreasing progress. For example, if there are four intermediate stages (N = 6
) then s2
is used for progress in the range [0, 25%)
, s3
for [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.