Skip to content

Commit 08c8f59

Browse files
committed
fix(tui): use explicit RGB app background
1 parent 9706d07 commit 08c8f59

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

src-rust/crates/tui/src/lib.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ mod tests {
351351
use claurst_core::types::{ContentBlock, Role, ToolResultContent};
352352
use dialogs::PermissionRequest;
353353
use notifications::NotificationKind;
354-
use ratatui::{backend::TestBackend, buffer::Buffer, layout::Rect, Terminal};
354+
use ratatui::{backend::TestBackend, buffer::Buffer, layout::Rect, style::Color, Terminal};
355355
use std::path::PathBuf;
356356
use std::sync::Arc;
357357
use tempfile::tempdir;
@@ -812,6 +812,20 @@ mod tests {
812812
assert!(rendered.contains("hello"));
813813
}
814814

815+
#[test]
816+
fn test_render_app_uses_explicit_rgb_background() {
817+
let backend = TestBackend::new(120, 40);
818+
let mut terminal = Terminal::new(backend).unwrap();
819+
let app = make_app();
820+
821+
terminal
822+
.draw(|frame| crate::render::render_app(frame, &app))
823+
.unwrap();
824+
825+
let background_cell = terminal.backend().buffer().cell((10, 20)).unwrap();
826+
assert_eq!(background_cell.bg, Color::Rgb(0, 0, 0));
827+
}
828+
815829
#[test]
816830
fn test_render_app_keeps_footer_visible_with_slash_suggestions() {
817831
let backend = TestBackend::new(120, 30);

src-rust/crates/tui/src/render.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const SPINNER: &[char] = &[
7777
'\u{2736}', '\u{2733}', '\u{2722}', '\u{00b7}',
7878
];
7979
const CLAUDE_ORANGE: Color = Color::Rgb(233, 30, 99);
80+
const APP_BACKGROUND: Color = Color::Rgb(0, 0, 0);
8081
const WELCOME_BOX_HEIGHT: u16 = 9;
8182
const STATUS_THINKING: &str = "thinking";
8283
const STATUS_THINKING_ELLIPSIS: &str = "thinking\u{2026}";
@@ -441,10 +442,10 @@ pub fn render_app(frame: &mut Frame, app: &App) {
441442
let size = frame.area();
442443
app.last_selectable_area.set(size);
443444

444-
// Fill the entire frame with a black background so the terminal's default
445-
// color (blue on Windows) doesn't bleed through cells not covered by widgets.
445+
// Fill the entire frame with explicit RGB black so terminal palette remaps
446+
// and default colors do not tint cells not covered by widgets.
446447
frame.render_widget(
447-
Block::default().style(Style::default().bg(Color::Black).fg(Color::White)),
448+
Block::default().style(Style::default().bg(APP_BACKGROUND).fg(Color::White)),
448449
size,
449450
);
450451

0 commit comments

Comments
 (0)