Skip to content

Commit c294097

Browse files
committed
🐛 fix variations icon and color when down side
1 parent 02f0180 commit c294097

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/info_bar.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@ impl InfoBar {
3636
}
3737
.to_string();
3838

39+
let variation_output = if main_set.variation > 0.0 {
40+
("↖", "green")
41+
} else {
42+
("↙", "red")
43+
};
44+
3945
output_str += &format!(
4046
"{:>width$} | Price: {price} | Highest: {high} | Lowest: {low} | Var.: {var} | Avg.: {avg} │",
4147
&self.name,
4248
width = YAxis::WIDTH as usize + 3,
4349
high = format!("{:.2}", main_set.max_price).green().bold(),
4450
low = format!("{:.2}", main_set.min_price).red().bold(),
45-
var = format!(" {:>+.2}%", main_set.variation).green().bold(),
51+
var = format!("{} {:>+.2}%", variation_output.0, main_set.variation).color(variation_output.1).bold(),
4652
avg = avg_format,
4753
price = format!("{:.2}", main_set.last_price).green().bold(),
4854
);

0 commit comments

Comments
 (0)