Expand description
Sub-cell-precision two-value progress bar for narrow terminal widths.
pixbar renders a progress bar with two stacked values — a primary
“played” position and a secondary “buffered / lookahead” marker — on a
single line, using standard Unicode 1/8 block characters (▏▎▍▌▋▊▉█).
No font installation is required. At 13 cells the bar resolves better
than 1%, at 40 cells better than 0.3%.
§Quick start
use pixbar::{Bar, Capability};
let s = Bar::new(40)
.primary(0.33) // 0.0 ..= 1.0
.secondary(0.67) // semantically >= primary
.capability(Capability::EighthBlock) // optional; auto-detected
.render();
print!("{}", s);§Architecture
The renderer is a pure function: (width, primary, secondary, capability)
produces a Vec<Cell> intermediate representation, which is then
serialized to ANSI by ansi::encode. The Cell IR is capability-agnostic
— glyph and color lookups happen end-of-pipe, which makes the renderer
snapshot- and property-testable and lets the same IR target multiple
backends (ANSI for terminals, optionally HTML via the html feature).
§Scope
This crate is a renderer, not a progress-reporting framework. Out of scope:
ETA / elapsed / throughput, spinners, MultiProgress orchestration,
iterator wrapping, style templating, auto-hide on non-TTY. Reach for
indicatif if you need those.
Re-exports§
pub use render::Cell;pub use render::CellKind;pub use detect::detect;pub use detect::detect_color;
Modules§
- ansi
- Cell-IR → ANSI string serializer with run-length-merged SGR sequences.
- detect
- Environment-driven capability and color auto-detection.
- glyphs
- Capability-specific glyph tables.
- html
- HTML serializer for the
Cellintermediate representation. - render
- Pure-function cell classification — the core of the renderer.
Structs§
- Bar
- A configured progress bar. Build with
Bar::newthen chain setters. - Rgb
- 24-bit truecolor channel triple (red, green, blue).
- Theme
- Foreground/background palette for the render layers.
Enums§
- Capability
- Rendering tier — controls sub-cell precision and glyph set.
- Overflow
Policy - How
Barreconciles aprimarygreater thansecondary.