unittest more of the color formats

* to ensure noticing if breaking changes happen
* document breaking change in changelog
This commit is contained in:
extrawurst 2024-05-22 11:25:37 +02:00 committed by extrawurst
parent 659ee74b04
commit ff59eb6c10
3 changed files with 34 additions and 9 deletions

View File

@ -7,8 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
### Breaking Changes
#### Theme file format
**note:** this actually applied to the previous release already: `0.26.2`
Ratatui (upstream terminal rendering crate) changed its serialization format for Colors. So the theme files have to be adjusted.
`selection_fg: Some(White)` -> `selection_fg: Some("White")`
but this also allows us now to define colors in the common hex format:
`selection_fg: Some(Rgb(0,255,0))` -> `selection_fg: Some("#00ff00")`
Checkout [THEME.md](./THEME.md) for more info.
### Fixes
* update yanked dependency to `libc` to fix building with `--locked`.
* document breaking change in theme file format.
## [0.26.2] - 2024-04-17 ## [0.26.2] - 2024-04-17
**note:** this release introduced a breaking change documented in the following release: `0.26.3`
### Fixes ### Fixes
* fix `cargo install` without `--locked` ([#2098](https://github.com/extrawurst/gitui/issues/2098)) * fix `cargo install` without `--locked` ([#2098](https://github.com/extrawurst/gitui/issues/2098))
* respect configuration for remote when fetching (also applies to pulling) [[@cruessler](https://github.com/cruessler)] ([#1093](https://github.com/extrawurst/gitui/issues/1093)) * respect configuration for remote when fetching (also applies to pulling) [[@cruessler](https://github.com/cruessler)] ([#1093](https://github.com/extrawurst/gitui/issues/1093))

View File

@ -18,8 +18,8 @@ Example theme override:
``` ```
( (
selection_bg: Some(Blue), selection_bg: Some("Blue"),
selection_fg: Some(White), selection_fg: Some("#ffffff"),
) )
``` ```
@ -27,9 +27,9 @@ Note that you need to wrap values in `Some` due to the way the overrides work (a
Notes: Notes:
* rgb colors might not be supported in every terminal. * rgb colors might not be supported in every terminal.
* using a color like `yellow` might appear in whatever your terminal/theme defines for `yellow` * using a color like `yellow` might appear in whatever your terminal/theme defines for `yellow`
* valid colors can be found in tui-rs' [Color](https://docs.rs/tui/0.12.0/tui/style/enum.Color.html) struct. * valid colors can be found in tui-rs' [Color](https://docs.rs/tui/0.12.0/tui/style/enum.Color.html) struct.
* all customizable theme elements can be found in [`style.rs` in the `impl Default for Theme` block](https://github.com/extrawurst/gitui/blob/master/src/ui/style.rs#L305) * all customizable theme elements can be found in [`style.rs` in the `impl Default for Theme` block](https://github.com/extrawurst/gitui/blob/master/src/ui/style.rs#L305)
## Customizing line breaks ## Customizing line breaks

View File

@ -374,18 +374,21 @@ mod tests {
writeln!( writeln!(
file, file,
r#" r##"
( (
selection_bg: Some("White"), selection_bg: Some("Black"),
selection_fg: Some("#ffffff"),
) )
"# "##
) )
.unwrap(); .unwrap();
let theme = Theme::init(&file.path().to_path_buf()); let theme = Theme::init(&file.path().to_path_buf());
assert_eq!(theme.selection_fg, Theme::default().selection_fg); assert_eq!(theme.selected_tab, Theme::default().selected_tab);
assert_eq!(theme.selection_bg, Color::White);
assert_ne!(theme.selection_bg, Theme::default().selection_bg); assert_ne!(theme.selection_bg, Theme::default().selection_bg);
assert_eq!(theme.selection_bg, Color::Black);
assert_eq!(theme.selection_fg, Color::Rgb(255, 255, 255));
} }
} }