Replace named Ratatui colors with RGB values
Project tests / check (push) Successful in 3m38s
Project tests / nix (push) Successful in 9m16s
Project tests / linux (push) Successful in 2m15s
Project tests / aur (push) Successful in 8m29s

Update docs, increase test count to 107, adjust flake.lock, and modify
rendering logic to use explicit Color::Rgb throughout the codebase.
This commit is contained in:
GarandPLG committed 2026-10-26 13:21:25 +01:00
1 parent b1f548e3d3
commit 851d3410dd
28 files changed
+282 -152

No files matched your search

+47 -1
View File
@@ -53,10 +53,56 @@ fn route_color_count(app: &mut App) -> usize {
.buffer()
.content
.iter()
.filter(|cell: &&Cell| -> bool { matches!(cell.fg, Color::Magenta | Color::LightMagenta) })
.filter(|cell: &&Cell| -> bool {
matches!(cell.fg, Color::Rgb(128, 0, 128) | Color::Rgb(255, 0, 255))
})
.count()
}
#[test]
fn focused_queued_route_is_yellow_until_drawing_a_task() -> () {
let mut app: App = app();
let board: &mut BoardState = &mut app.states_mut().unwrap().skirmish.board;
board.cells[5][3].set_structure(Structures::Tunnel(Tunnel::new()));
board.cells[5][2]
.get_mut_option_unit()
.set_task(Tasks::Moving(MovingTask::new([(5, 3)].into())));
board.change_focused_cell(MoveFocusedCell::Right);
for drawing in [false, true] {
if drawing {
press(&mut app, KeyCode::Left);
press(&mut app, KeyCode::Char(' '));
}
let board: &BoardState = &app.states_ref().unwrap().skirmish.board;
assert_eq!(board.get_focused_cell().get_coords(), (5, 3));
for stress in [false, true] {
app.states_mut().unwrap().skirmish.stress_view = stress;
let mut terminal: Terminal<TestBackend> =
Terminal::new(TestBackend::new(160, 50)).unwrap();
terminal
.draw(|frame: &mut ratatui::Frame<'_>| -> () {
frame.render_widget(&mut app, frame.area());
})
.unwrap();
let corner: &Cell = &terminal
.backend()
.buffer()
.content
.windows(3)
.find(|cells: &&[Cell]| -> bool {
cells[0].symbol() == "╭" && cells[1].symbol() == "D" && cells[2].symbol() == "5"
})
.unwrap()[0];
let expected: Color = if drawing {
Color::Rgb(128, 0, 128)
} else {
Color::Rgb(255, 255, 0)
};
assert_eq!(corner.fg, expected);
}
}
}
#[test]
fn queued_route_colors_follow_progress_and_cancellation_without_marking_model() -> () {
let mut app: App = app();