2. The look of the bar

The bar of chapter 1 is a row of stars. Its look is made of elements, each one a string you choose:
call bar%initialize(prefix_string='march ', suffix_string=' time steps', &
bracket_left_string='[', bracket_right_string=']', &
filled_char_string='#', empty_char_string='.', &
width=40, max_value=real(steps, R8P))While running:
$ march
march [####################....................] time stepsThe line is drawn in this order:
prefix bracket_left filled × n empty × (width − n) bracket_right suffix
march [ ########## .......... ] time stepswidthis the number of characters between the brackets;nis the progress timeswidth, rounded.filled_char_stringandempty_char_stringare repeatednandwidth − ntimes: use one character each, or the bar becomes wider thanwidth.- The prefix, the brackets and the suffix are drawn as given, spaces included:
prefix_string='march 'ends with a space to keep the name apart from the bracket.
Unicode
Every string can be Unicode: write it in the source, saved as UTF-8.
call bar%initialize(prefix_string='march ', bracket_left_string='▕', bracket_right_string='▏', &
filled_char_string='█', empty_char_string='░', &
width=40, max_value=real(steps, R8P))$ march
march ▕████████████████████░░░░░░░░░░░░░░░░░░░░▏The strings are class(*): plain literals as above, or literals of the UCS4 kind that forbear exports (UCS4_'█'), both work.
A smooth bar
A character is a coarse step: with width=40, one step every 2.5%. partial_blocks=.true. draws the bar with the Unicode partial blocks ▏▎▍▌▋▊▉█, eight steps per character:
call bar%initialize(prefix_string='march ', bracket_left_string='▕', bracket_right_string='▏', &
partial_blocks=.true., filled_char_color_fg='cyan', &
width=40, max_value=real(steps, R8P))$ march
march ▕██████████████████▍ ▏While running, at 46%: 18 full cells and three eighths of the next one. The done part is always the full block █, in the colours of filled_char; the empty part is empty_char_string, a space by default. To draw the track of the bar, give the empty part a background colour (empty_char_color_bg): the partial cell takes it too, and the bar has no seam.
What you learned
The elements of the line, their order, the width; Unicode strings; partial blocks. Reference: The bar object.
Next: 3. Colours and styles.