Skip to content

Commit 41daaec

Browse files
committed
Base bar gradient on total width instead of filled cells
1 parent 5e8f4b9 commit 41daaec

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

src/tui/widgets/bar.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ pub fn make_bar(value: f64, max_value: f64, width: u16) -> Vec<Span<'static>> {
2525
let filled = (ratio * width as f64).round() as usize;
2626
let mut spans = Vec::new();
2727
for i in 0..filled {
28-
let pct = if filled > 1 {
29-
i as f64 / (filled - 1) as f64
30-
} else {
31-
0.5
32-
};
28+
let pct = i as f64 / width as f64;
3329
spans.push(Span::styled(
3430
"\u{2588}",
3531
Style::default().fg(gradient_color(pct)),

0 commit comments

Comments
 (0)