diff --git a/docs/config.md b/docs/config.md index 0f4f036c..d2bddeef 100644 --- a/docs/config.md +++ b/docs/config.md @@ -14,19 +14,24 @@ One use of a config file is to set boot flags to execute without having to state Another use is to set colours, under the `[colors]`. The following labels are customizable with hex colour code strings: -- Table header colours (`table_header_color="#ffffff"`). -- Every CPU core colour as an array (`cpu_core_colors=["#ffffff", "#000000", "#111111"]`). - - bottom will look at 216 (let's be realistic here) colours at most, and in order. - - If not enough colours are provided for the number of threads on the CPU, then the rest will be automatically generated. -- RAM and SWAP colours (`ram_color="#ffffff"`, `swap_color="#111111"`). -- RX and TX colours (`rx_color="#ffffff"`, `tx_color="#111111"`). -- Widget title colour (`widget_title_color="#ffffff"`). -- General widget border colour (`border_color="#ffffff"`). -- Current widget border colour (`highlighted_border_color="#ffffff"`). -- Text colour (`text_color="#ffffff"`). -- Label and graph colour (`graph_color="#ffffff"`). -- Cursor colour (`cursor_color="#ffffff"`). -- Current selected scroll entry colour (`scroll_entry_text_color="#282828"`, `scroll_entry_bg_color="#458588"`). +| Labels | Details | Example | +| ------------------------------- | ---------------------------------------------- | --------------------------------------------------- | +| Table header colours | Colour of table headers | `table_header_color="#ffffff"` | +| CPU colour per core | Colour of each core. Read in order. | `cpu_core_colors=["#ffffff", "#000000", "#111111"]` | +| | Looks at 256 colours at most. | +| Average CPU colour | The average CPU color | `avg_cpu_color="#d3869b"` | +| RAM | The colour RAM will use | `ram_color="#ffffff"` | +| SWAP | The colour SWAP will use | `swap_color="#111111"` | +| RX | The colour rx will use | `rx_color="#ffffff"` | +| TX | The colour tx will use | `tx_color="#111111"` | +| Widget title colour | The colour of the label each widget has | `widget_title_color="#ffffff"` | +| Border colour | The colour of the border of unselected widgets | `border_color="#ffffff"` | +| Selected border colour | The colour of the border of selected widgets | `highlighted_border_color="#ffffff"` | +| Text colour | The colour of most text | `text_color="#ffffff"` | +| Graph colour | The colour of the lines and text of the graph | `graph_color="#ffffff"` | +| Cursor colour | The cursor's colour | `cursor_color="#ffffff"` | +| Selected text colour | The colour of text that is selected | `scroll_entry_text_color="#282828"` | +| Selected text background colour | The background colour of text that is selected | `scroll_entry_bg_color="#458588"` | Note some colours may not be compatible with the terminal you are using. For example, macOS's default Terminal does not play nice with many colours. diff --git a/sample_configs/bottom.toml b/sample_configs/bottom.toml index 0d4df0a8..a6b47855 100644 --- a/sample_configs/bottom.toml +++ b/sample_configs/bottom.toml @@ -5,7 +5,7 @@ # This group of options represents a command-line flag/option. Flags explicitly # added when running (ie: btm -a) will override this config file if an option # is also set here. -#[flags] +[flags] #avg_cpu = true #dot_marker = false @@ -41,7 +41,7 @@ # macOS default Terminal does NOT like custom colours and it will glitch out. # # The default options here are based on gruvbox: https://github.com/morhetz/gruvbox -#[colors] +[colors] # Represents the colour of table headers (processes, CPU, disks, temperature). #table_header_color="#458588" @@ -49,6 +49,9 @@ # Represents the colour of the label each widget has. #widget_title_color="#cc241d" +# Represents the average CPU color +#avg_cpu_color="#d3869b" + # Represents the colour the core will use in the CPU legend and graph. #cpu_core_colors=["#cc241d", "#98971a"] @@ -70,7 +73,7 @@ # Represents the colour of the border of selected widgets. #highlighted_border_color="#fe8019" -# Represents the colour of the border of most text that is otherwise not covered. +# Represents the colour of most text. #text_color="#ebdbb2" # Represents the colour of text that is selected. @@ -81,3 +84,6 @@ # Represents the colour of the lines and text of the graph. #graph_color="#ebdbb2" + +# Represents the cursor's colour. +#cursor_color="#458588" \ No newline at end of file diff --git a/src/canvas.rs b/src/canvas.rs index cef90a66..4bb73bf1 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -562,8 +562,12 @@ impl Painter { Marker::Braille }) .style( - self.colours.cpu_colour_styles - [itx % self.colours.cpu_colour_styles.len()], + if app_state.app_config_fields.show_average_cpu && itx == 0 { + self.colours.avg_colour_style + } else { + self.colours.cpu_colour_styles + [itx % self.colours.cpu_colour_styles.len()] + }, ) .data(&cpu.cpu_data[..]), ) @@ -668,6 +672,8 @@ impl Painter { .current_scroll_position - start_position { self.colours.currently_selected_text_style + } else if app_state.app_config_fields.show_average_cpu && itx == 0 { + self.colours.avg_colour_style } else { self.colours.cpu_colour_styles[itx + start_position as usize @@ -675,8 +681,13 @@ impl Painter { } } _ => { - self.colours.cpu_colour_styles[itx - + start_position as usize % self.colours.cpu_colour_styles.len()] + if app_state.app_config_fields.show_average_cpu && itx == 0 { + self.colours.avg_colour_style + } else { + self.colours.cpu_colour_styles[itx + + start_position as usize + % self.colours.cpu_colour_styles.len()] + } } }, ) diff --git a/src/canvas/canvas_colours.rs b/src/canvas/canvas_colours.rs index 07aaa480..9e3035fb 100644 --- a/src/canvas/canvas_colours.rs +++ b/src/canvas/canvas_colours.rs @@ -13,6 +13,7 @@ pub struct CanvasColours { pub swap_style: Style, pub rx_style: Style, pub tx_style: Style, + pub avg_colour_style: Style, pub cpu_colour_styles: Vec