refactor: refactor some fields and code to use "colour" spelling (#2058)

<!-- Please use this template (unless you have a very good reason not
to). PRs that do not use the template may be closed. -->

## Description

_A description of the change, what it does, and why it was made. If
relevant (e.g. UI changes), **please also provide
screenshots/recordings**:_

Rename a bunch of code/struct field names to use "colour". Note this
should have no functional change to config settings as I was already
aliasing "colour" for "color" settings, this just flips it internally.

As for why, I'm Canadian, I grew up spelling it this way, sorry.

## Issue

_If applicable, what issue does this address?_

Closes: #<issue-number>

## Testing

_If relevant, please state how this was tested (including steps):_

_If this change affects the program, please also indicate which
platforms were tested:_

- [ ] _Windows_
- [ ] _macOS (specify version below)_
- [x] _Linux (specify distro below)_
- [ ] _Other (specify below)_

## Checklist

_Ensure **all** of these are met:_

- [x] _If this PR adds or changes a dependency, please justify this in
the description_
- [x] _If this is a code change, areas your change affects have been
linted using (`cargo fmt`)_
- [x] _If this is a code change, your changes pass `cargo clippy --all
-- -D warnings`_
- [x] _If this is a code change, new tests were added if relevant_
- [x] _If this is a code change, your changes pass `cargo test`_
- [x] _The change has been tested to work (see above) and doesn't appear
to break other things_
- [x] _Documentation has been updated if needed (`README.md`, help menu,
docs, configs, etc.)_
- [x] _There are no merge conflicts_
- [x] _You have reviewed your changes first_
- [x] _The pull request passes the provided CI pipeline_

## Other

_Anything else that maintainers should know about this PR:_
This commit is contained in:
Clement Tsang
2026-05-08 01:34:02 -04:00
committed by GitHub
parent abad5b6f1e
commit d08036f69a
29 changed files with 510 additions and 349 deletions
@@ -93,9 +93,9 @@ see information on these options by running `btm -h`, or run `btm --help` to dis
## Style Options
| Option | Behaviour |
| ------------------ | ---------------------------------------------------------------- |
| `--theme <SCHEME>` | Use a built-in color theme, use '--help' for info on the colors. |
| Option | Behaviour |
| ------------------ | ------------------------------------------------------------------ |
| `--theme <SCHEME>` | Use a built-in colour theme, use '--help' for info on the colours. |
## Other Options
@@ -42,6 +42,28 @@ bottom's components can also be individually styled by the user to control the c
### Colours
!!! Info
Note that anywhere `"colour"` is used, it can be substituted for `"color"`:
```toml
# This is okay
[styles.widgets.widget_title]
colour = "black"
bg_colour = "white"
[styles.cpu]
all_entry_colour = "green"
# This is also okay
[styles.widgets.widget_title]
color = "black"
bg_color = "white"
[styles.cpu]
all_entry_color = "green"
```
You can configure the colours for components with strings that are either hex colours (e.g. `"#ffffff"`), RGB colours
(e.g. `"255, 255, 255"`), or named colours. Named colours are one of the following strings:
@@ -69,19 +91,19 @@ Text can generally be styled using the following TOML table:
```toml
[field]
# The foreground colour of text.
color = "black"
colour = "black"
# The background colour of text.
bg_color = "blue"
bg_colour = "blue"
# Whether to make the text bold.
bold = false
# Inline table version
field = { color = "black", bg_color = "blue", bold = false }
field = { colour = "black", bg_colour = "blue", bold = false }
```
All fields are optional; by default if `bg_color` is not set then there will be no background color.
All fields are optional; by default if `bg_colour` is not set then there will be no background colour.
If you _just_ want to style text by setting the foreground colour, for brevity, then you can also just set the field
to be the colour itself. For example:
@@ -97,81 +119,81 @@ selected_text = "#fff"
These can be set under `[styles.cpu]`:
| Config field | Details | Examples |
| ----------------- | ---------------------------------------------------------------- | -------------------------------------------- |
| `all_entry_color` | The colour of the "All" CPU label | `all_entry_color = "Red"` |
| `avg_entry_color` | The colour of the average CPU label and graph line | `avg_entry_color = "255, 0, 255"` |
| `cpu_core_colors` | Colour of each CPU threads' label and graph line. Read in order. | `cpu_core_colors = ["Red", "Blue", "Green"]` |
| Config field | Details | Examples |
| ------------------ | ---------------------------------------------------------------- | --------------------------------------------- |
| `all_entry_colour` | The colour of the "All" CPU label | `all_entry_colour = "Red"` |
| `avg_entry_colour` | The colour of the average CPU label and graph line | `avg_entry_colour = "255, 0, 255"` |
| `cpu_core_colours` | Colour of each CPU threads' label and graph line. Read in order. | `cpu_core_colours = ["Red", "Blue", "Green"]` |
#### Temperature Graph
These can be set under `[styles.temp_graph]`:
| Config field | Details | Examples |
| ------------------------- | -------------------------------------------------------------- | ---------------------------------------------------- |
| `temp_graph_color_styles` | Colour of each temperature sensor's graph line. Read in order. | `temp_graph_color_styles = ["Red", "Blue", "Green"]` |
| Config field | Details | Examples |
| -------------------------- | -------------------------------------------------------------- | ----------------------------------------------------- |
| `temp_graph_colour_styles` | Colour of each temperature sensor's graph line. Read in order. | `temp_graph_colour_styles = ["Red", "Blue", "Green"]` |
#### Memory
These can be set under `[styles.memory]`:
| Config field | Details | Examples |
| ------------- | ------------------------------------------------------------------------------ | --------------------------------------- |
| `ram_color` | The colour of the RAM label and graph line | `ram_color = "Red"` |
| `cache_color` | The colour of the cache label and graph line. Does not do anything on Windows. | `cache_color = "#ffffff"` |
| `swap_color` | The colour of the swap label and graph line | `swap_color = "255, 0, 255"` |
| `arc_color` | The colour of the ARC label and graph line | `arc_color = "Blue"` |
| `gpu_colors` | Colour of each GPU's memory label and graph line. Read in order. | `gpu_colors = ["Red", "Blue", "Green"]` |
| Config field | Details | Examples |
| -------------- | ------------------------------------------------------------------------------ | ---------------------------------------- |
| `ram_colour` | The colour of the RAM label and graph line | `ram_colour = "Red"` |
| `cache_colour` | The colour of the cache label and graph line. Does not do anything on Windows. | `cache_colour = "#ffffff"` |
| `swap_colour` | The colour of the swap label and graph line | `swap_colour = "255, 0, 255"` |
| `arc_colour` | The colour of the ARC label and graph line | `arc_colour = "Blue"` |
| `gpu_colours` | Colour of each GPU's memory label and graph line. Read in order. | `gpu_colours = ["Red", "Blue", "Green"]` |
#### Network
These can be set under `[styles.network]`:
| Config field | Details | Examples |
| ---------------- | --------------------------------------------------------- | ---------------------------- |
| `rx_color` | The colour of the RX (download) label and graph line | `rx_color = "Red"` |
| `tx_color` | The colour of the TX (upload) label and graph line | `tx_color = "#ffffff"` |
| `rx_total_color` | The colour of the total RX (download) label in basic mode | `rx_total_color = "0, 0, 0"` |
| `tx_total_color` | The colour of the total TX (upload) label in basic mode | `tx_total_color = "#000"` |
| Config field | Details | Examples |
| ----------------- | --------------------------------------------------------- | ----------------------------- |
| `rx_colour` | The colour of the RX (download) label and graph line | `rx_colour = "Red"` |
| `tx_colour` | The colour of the TX (upload) label and graph line | `tx_colour = "#ffffff"` |
| `rx_total_colour` | The colour of the total RX (download) label in basic mode | `rx_total_colour = "0, 0, 0"` |
| `tx_total_colour` | The colour of the total TX (upload) label in basic mode | `tx_total_colour = "#000"` |
#### Battery
These can be set under `[styles.battery]`:
| Config field | Details | Examples |
| ---------------------- | ------------------------------------------------------------------------ | ---------------------------------- |
| `high_battery_color` | The colour of the battery widget bar when the battery is over 50% | `high_battery_color = "Red"` |
| `medium_battery_color` | The colour of the battery widget bar when the battery between 10% to 50% | `medium_battery_color = "#ffffff"` |
| `low_battery_color` | The colour of the battery widget bar when the battery is under 10% | `low_battery_color = "0, 0, 0"` |
| Config field | Details | Examples |
| ----------------------- | ------------------------------------------------------------------------ | ----------------------------------- |
| `high_battery_colour` | The colour of the battery widget bar when the battery is over 50% | `high_battery_colour = "Red"` |
| `medium_battery_colour` | The colour of the battery widget bar when the battery between 10% to 50% | `medium_battery_colour = "#ffffff"` |
| `low_battery_colour` | The colour of the battery widget bar when the battery is under 10% | `low_battery_colour = "0, 0, 0"` |
#### Tables
These can be set under `[styles.tables]`:
| Config field | Details | Examples |
| ------------ | ------------------------------ | -------------------------------------------------------------- |
| `headers` | Text styling for table headers | `headers = { color = "red", bg_color = "black", bold = true }` |
| Config field | Details | Examples |
| ------------ | ------------------------------ | ---------------------------------------------------------------- |
| `headers` | Text styling for table headers | `headers = { colour = "red", bg_colour = "black", bold = true }` |
#### Graphs
These can be set under `[styles.graphs]`:
| Config field | Details | Examples |
| ------------- | -------------------------------------------- | ------------------------------------------------------------------- |
| `graph_color` | The general colour of the parts of the graph | `graph_color = "white"` |
| `legend_text` | Text styling for graph's legend text | `legend_text = { color = "black", bg_color = "blue", bold = true }` |
| Config field | Details | Examples |
| -------------- | -------------------------------------------- | --------------------------------------------------------------------- |
| `graph_colour` | The general colour of the parts of the graph | `graph_colour = "white"` |
| `legend_text` | Text styling for graph's legend text | `legend_text = { colour = "black", bg_colour = "blue", bold = true }` |
#### General widget settings
These can be set under `[styles.widgets]`:
| Config field | Details | Examples |
| ----------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `border_color` | The colour of the widgets' borders | `border_color = "white"` |
| `selected_border_color` | The colour of a widget's borders when the widget is selected | `selected_border_color = "white"` |
| `widget_title` | Text styling for a widget's title | `widget_title = { color = "black", bg_color = "blue", bold = true }` |
| `bg_color` | The background color of the widgets. | `bg_color = "black"` |
| `text` | Text styling for text in general | `text = { color = "black", bg_color = "blue", bold = true }` |
| `selected_text` | Text styling for text when representing something that is selected | `selected_text = { color = "black", bg_color = "blue", bold = true }` |
| `disabled_text` | Text styling for text when representing something that is disabled | `disabled_text = { color = "black", bg_color = "blue", bold = true }` |
| `thread_text` | Text styling for text when representing process threads. Only usable on Linux at the moment. | `thread_text = { color = "green", bg_color = "blue", bold = true }` |
| Config field | Details | Examples |
| ------------------------ | -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| `border_colour` | The colour of the widgets' borders | `border_colour = "white"` |
| `selected_border_colour` | The colour of a widget's borders when the widget is selected | `selected_border_colour = "white"` |
| `widget_title` | Text styling for a widget's title | `widget_title = { colour = "black", bg_colour = "blue", bold = true }` |
| `bg_colour` | The background colour of the widgets. | `bg_colour = "black"` |
| `text` | Text styling for text in general | `text = { colour = "black", bg_colour = "blue", bold = true }` |
| `selected_text` | Text styling for text when representing something that is selected | `selected_text = { colour = "black", bg_colour = "blue", bold = true }` |
| `disabled_text` | Text styling for text when representing something that is disabled | `disabled_text = { colour = "black", bg_colour = "blue", bold = true }` |
| `thread_text` | Text styling for text when representing process threads. Only usable on Linux at the moment. | `thread_text = { colour = "green", bg_colour = "blue", bold = true }` |
+14 -13
View File
@@ -61,22 +61,22 @@ Let's say you're installing [Iosevka](https://github.com/be5invis/Iosevka). The
4. Here, add a new `String value`, and set the `Name` to a bunch of 0's (e.g. `000` - make sure the name isn't already used), then set the `Data` to the font name (e.g. `Iosevka`).
<figure>
<img src="../assets/screenshots/troubleshooting/regedit_fonts.webp" alt="Regedit menu showing how to add a new font for Command Prompt/PowerShell"/>
<figcaption><sub>The last entry is the new entry for Iosevka</sub></figcaption>
</figure>
<figure>
<img src="../assets/screenshots/troubleshooting/regedit_fonts.webp" alt="Regedit menu showing how to add a new font for Command Prompt/PowerShell"/>
<figcaption><sub>The last entry is the new entry for Iosevka</sub></figcaption>
</figure>
5. Then, open the Command Prompt/PowerShell, and right-click on the top bar, and open "Properties":
<figure>
<img src="../assets/screenshots/troubleshooting/cmd_prompt_props.webp" alt="Opening the properties menu in Command Prompt/PowerShell"/>
</figure>
<figure>
<img src="../assets/screenshots/troubleshooting/cmd_prompt_props.webp" alt="Opening the properties menu in Command Prompt/PowerShell"/>
</figure>
6. From here, go to "Font", and set the font to your new font (so in this example, Iosevka):
<figure>
<img src="../assets/screenshots/troubleshooting/cmd_prompt_font.webp" alt="Setting a new font in Command Prompt/PowerShell"/>
</figure>
<figure>
<img src="../assets/screenshots/troubleshooting/cmd_prompt_font.webp" alt="Setting a new font in Command Prompt/PowerShell"/>
</figure>
## Why can't I see all my temperature sensors on Windows?
@@ -122,7 +122,7 @@ It may be handy to refer to the automatically generated config files or the
[sample configuration files](https://github.com/ClementTsang/bottom/tree/main/sample_configs). The config files also
follow the [TOML](https://toml.io/en/) format.
Also make sure your config options are under the right table - for example, to set your temperature type, you must
Also make sure your config option settings are in the right location - for example, to set your temperature type, you must
set it under the `[flags]` table:
```toml
@@ -130,11 +130,12 @@ set it under the `[flags]` table:
temperature_type = "f"
```
Meanwhile, if you want to set a custom color scheme, it would be under the `[styles]` table:
Meanwhile, if you want to set a custom colour or styling scheme, it would be under the `[styles]` table - for example:
```toml
[styles.tables.headers]
color="LightBlue"
colour = "LightBlue"
bold = true
```
To help validate your configuration files, there is [JSON Schema](https://json-schema.org/) support if your IDE/editor
+3 -3
View File
@@ -64,11 +64,11 @@ is added together when displayed.
<img src="../../../assets/screenshots/process/process_grouped.webp" alt="A picture of grouped mode in a process widget."/>
</figure>
!!! info
!!! Info
Note that the process state and user columns are disabled in this mode.
!!! info
!!! Info
Note that if tree mode is also active, processes cannot be grouped together due to the behaviour of the two modes
somewhat clashing. This also reflects with default modes like `group_processes`.
@@ -103,7 +103,7 @@ A process in tree mode can also be "collapsed", hiding its children and any desc
++plus++, or ++left++ keys, or clicking on an entry. It can be expanded by using the ++minus++, ++plus++, or ++right++
keys, or by clicking on the entry again. The ++space++ key can also be used to toggle between the collapsed and expanded states.
!!! info
!!! Info
Note that if tree mode is active, processes cannot be grouped together due to the behaviour of the two modes
somewhat clashing. This also reflects with default modes like `group_processes`.