diff --git a/CHANGELOG.md b/CHANGELOG.md index cb85ef99..9f18aefe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Bug Fixes +## [0.5.5] - Unreleased + +## Bug Fixes + +- [#349](https://github.com/ClementTsang/bottom/pull/349): Fixed CPU graph colours not matching the legend in the "all" state. + ## [0.5.4] - 2020-12-10 ## Changes diff --git a/src/canvas/widgets/cpu_graph.rs b/src/canvas/widgets/cpu_graph.rs index e757c826..299fe032 100644 --- a/src/canvas/widgets/cpu_graph.rs +++ b/src/canvas/widgets/cpu_graph.rs @@ -199,9 +199,16 @@ impl CpuGraphWidget for Painter { }) .style(if show_avg_cpu && itx == AVG_POSITION { self.colours.avg_colour_style + } else if itx == ALL_POSITION { + self.colours.all_colour_style } else { - self.colours.cpu_colour_styles - [itx % self.colours.cpu_colour_styles.len()] + self.colours.cpu_colour_styles[(itx - 1 // Because of the all position + - (if show_avg_cpu { + AVG_POSITION + } else { + 0 + })) + % self.colours.cpu_colour_styles.len()] }) .data(&cpu.cpu_data[..]) .graph_type(tui::widgets::GraphType::Line)