Skip to content

Commit ff59eb6

Browse files
committed
unittest more of the color formats
* to ensure noticing if breaking changes happen * document breaking change in changelog
1 parent 659ee74 commit ff59eb6

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Breaking Changes
11+
12+
#### Theme file format
13+
14+
**note:** this actually applied to the previous release already: `0.26.2`
15+
16+
Ratatui (upstream terminal rendering crate) changed its serialization format for Colors. So the theme files have to be adjusted.
17+
18+
`selection_fg: Some(White)` -> `selection_fg: Some("White")`
19+
20+
but this also allows us now to define colors in the common hex format:
21+
22+
`selection_fg: Some(Rgb(0,255,0))` -> `selection_fg: Some("#00ff00")`
23+
24+
Checkout [THEME.md](./THEME.md) for more info.
25+
26+
### Fixes
27+
* update yanked dependency to `libc` to fix building with `--locked`.
28+
* document breaking change in theme file format.
29+
1030
## [0.26.2] - 2024-04-17
1131

32+
**note:** this release introduced a breaking change documented in the following release: `0.26.3`
33+
1234
### Fixes
1335
* fix `cargo install` without `--locked` ([#2098](https://github.com/extrawurst/gitui/issues/2098))
1436
* respect configuration for remote when fetching (also applies to pulling) [[@cruessler](https://github.com/cruessler)] ([#1093](https://github.com/extrawurst/gitui/issues/1093))

THEMES.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ Example theme override:
1818

1919
```
2020
(
21-
selection_bg: Some(Blue),
22-
selection_fg: Some(White),
21+
selection_bg: Some("Blue"),
22+
selection_fg: Some("#ffffff"),
2323
)
2424
```
2525

2626
Note that you need to wrap values in `Some` due to the way the overrides work (as of 0.23).
2727

2828
Notes:
2929

30-
* rgb colors might not be supported in every terminal.
30+
* rgb colors might not be supported in every terminal.
3131
* using a color like `yellow` might appear in whatever your terminal/theme defines for `yellow`
32-
* valid colors can be found in tui-rs' [Color](https://docs.rs/tui/0.12.0/tui/style/enum.Color.html) struct.
32+
* valid colors can be found in tui-rs' [Color](https://docs.rs/tui/0.12.0/tui/style/enum.Color.html) struct.
3333
* 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)
3434

3535
## Customizing line breaks

src/ui/style.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,18 +374,21 @@ mod tests {
374374

375375
writeln!(
376376
file,
377-
r#"
377+
r##"
378378
(
379-
selection_bg: Some("White"),
379+
selection_bg: Some("Black"),
380+
selection_fg: Some("#ffffff"),
380381
)
381-
"#
382+
"##
382383
)
383384
.unwrap();
384385

385386
let theme = Theme::init(&file.path().to_path_buf());
386387

387-
assert_eq!(theme.selection_fg, Theme::default().selection_fg);
388-
assert_eq!(theme.selection_bg, Color::White);
388+
assert_eq!(theme.selected_tab, Theme::default().selected_tab);
389+
389390
assert_ne!(theme.selection_bg, Theme::default().selection_bg);
391+
assert_eq!(theme.selection_bg, Color::Black);
392+
assert_eq!(theme.selection_fg, Color::Rgb(255, 255, 255));
390393
}
391394
}

0 commit comments

Comments
 (0)