Skip to content

background color and centering, how to? #103

@x37v

Description

@x37v

I'm drawing to a display that doesn't seem to perfectly match any of the font size options you've provided so I get some extra borders around my terminal that are drawn white. I have a few questions regarding that.

  1. is there a way to make this area black instead of white
  2. is there a way to adjust the centering of the drawn area, it looks like if i shifted everything up and right 1 pixel it would be centered better.

Maybe I'm just configuring something incorrectly?

here is how i'm drawing (copied from your examples)

let text = "Ratatui on embedded devices!";
let paragraph = Paragraph::new(text.white()).wrap(Wrap { trim: true }).on_black();
let bordered_block = Block::bordered()
	.border_style(Style::new().white())
	.title("Mousefood");
frame.render_widget(paragraph.block(bordered_block), frame.area());

here is how i setup my terminal

let config = EmbeddedBackendConfig {
	flush_callback: Box::new(move |d: &mut MoveDisplay| { 
          draw_tx.send(DrawCommand { data: d.framebuffer().clone() }).unwrap();
	}),
	font_regular: mousefood::fonts::MONO_5X8,
	font_bold: mousefood::fonts::MONO_5X8,
	..Default::default()
};

let backend = EmbeddedBackend::new(&mut display, config);
let mut terminal = ratatui::Terminal::new(backend).expect("to create terminal");

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions