MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / center_text

Function center_text

crates/opencode-tui/src/ui/text.rs:43–50  ·  view source on GitHub ↗
(text: &str, width: usize)

Source from the content-addressed store, hash-verified

41}
42
43pub fn center_text(text: &str, width: usize) -> String {
44 let text_width = text.width();
45 if text_width >= width {
46 return text.to_string();
47 }
48 let left_pad = (width - text_width) / 2;
49 format!("{}{}", " ".repeat(left_pad), text)
50}
51
52pub fn highlight_text<'a>(text: &'a str, color: ratatui::style::Color) -> Span<'a> {
53 Span::styled(text, ratatui::style::Style::default().fg(color))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected