Skip to main content

retroglyph_core/symbols/
bar.rs

1/// Filled 1/8 from the bottom.
2pub const ONE_EIGHTH: char = '▁';
3/// Filled 1/4 from the bottom.
4pub const ONE_QUARTER: char = '▂';
5/// Filled 3/8 from the bottom.
6pub const THREE_EIGHTHS: char = '▃';
7/// Filled 1/2 from the bottom.
8pub const HALF: char = '▄';
9/// Filled 5/8 from the bottom.
10pub const FIVE_EIGHTHS: char = '▅';
11/// Filled 3/4 from the bottom.
12pub const THREE_QUARTERS: char = '▆';
13/// Filled 7/8 from the bottom.
14pub const SEVEN_EIGHTHS: char = '▇';
15/// A fully filled cell.
16pub const FULL: char = '█';
17
18/// The nine bar levels from empty to full, indexed `0..=8`: a blank cell, then
19/// [`ONE_EIGHTH`] through [`FULL`] in order.
20///
21/// Indexing this directly by `round(fraction * 8.0) as usize` turns a `0.0..=1.0` magnitude
22/// into the right glyph for one bar column.
23pub const NINE_LEVELS: [char; 9] = [
24    ' ',
25    ONE_EIGHTH,
26    ONE_QUARTER,
27    THREE_EIGHTHS,
28    HALF,
29    FIVE_EIGHTHS,
30    THREE_QUARTERS,
31    SEVEN_EIGHTHS,
32    FULL,
33];