feat(tui): give the panes the colour the demo promised

The cursor row set a foreground, and ratatui only skips a cell's colour
when that field is None — so selecting a row repainted its gold sizes,
blue usernames and status glyphs into one flat cream. Table cursors now
tint the background only, over a warm oxide wash instead of neutral.

Browse files, their sizes and the settings popup rendered in the raw
terminal foreground; they take the palette now, and free slots read
green when a peer has one.
This commit is contained in:
Michel de Graaf
2026-07-25 03:44:07 +02:00
parent fce4b765b7
commit c6d41796c9
8 changed files with 95 additions and 52 deletions
+17 -1
View File
@@ -11,6 +11,9 @@ use soulseek_rs::DownloadStatus;
pub const PANE_PADDING: Padding = Padding::horizontal(1);
pub const VINYL_2: Color = Color::Rgb(0x26, 0x21, 0x1D);
/// A warm oxide wash for the cursor row — dark enough that every column keeps
/// its own colour on top of it.
pub const SELECTION: Color = Color::Rgb(0x30, 0x1B, 0x14);
pub const DUST: Color = Color::Rgb(0x8A, 0x81, 0x78);
pub const PAPER: Color = Color::Rgb(0xE8, 0xE1, 0xD6);
pub const PAPER_DIM: Color = Color::Rgb(0xC9, 0xC1, 0xB4);
@@ -45,11 +48,17 @@ pub fn header_style() -> Style {
pub fn highlight_style() -> Style {
Style::default()
.bg(VINYL_2)
.bg(SELECTION)
.fg(PAPER)
.add_modifier(Modifier::BOLD)
}
/// The cursor row in a table. No foreground: a table row already colours its
/// own cells, and setting one here would flatten them all to a single tone.
pub fn row_highlight_style() -> Style {
Style::default().bg(SELECTION).add_modifier(Modifier::BOLD)
}
pub fn success_style() -> Style {
Style::default().fg(COLOR_SUCCESS)
}
@@ -252,6 +261,13 @@ mod tests {
}
}
#[test]
fn table_cursor_row_tints_the_background_without_recolouring_cells() {
let cursor = row_highlight_style();
assert_eq!(cursor.fg, None);
assert_eq!(cursor.bg, Some(SELECTION));
}
#[test]
fn progress_bar_splits_fill_and_track() {
let bar = format_progress_bar(0.25, 20, 25);