Skip to main content

binocular/ui/
indicators.rs

1use crate::app::InputMode;
2use ratatui::{
3    style::{Color, Style},
4    text::Span,
5};
6
7pub fn mode_indicator(mode: &InputMode, command_buffer: Option<&str>) -> Span<'static> {
8    match mode {
9        InputMode::Insert => Span::styled(
10            " INSERT ",
11            Style::default().bg(Color::Green).fg(Color::Black),
12        ),
13        InputMode::Normal => Span::styled(
14            " NORMAL ",
15            Style::default().bg(Color::Blue).fg(Color::White),
16        ),
17        InputMode::Visual => Span::styled(
18            " VISUAL ",
19            Style::default().bg(Color::Magenta).fg(Color::White),
20        ),
21        InputMode::VisualLine => Span::styled(
22            " V-LINE ",
23            Style::default().bg(Color::Magenta).fg(Color::White),
24        ),
25        InputMode::Command => Span::styled(
26            format!(" :{} ", command_buffer.unwrap_or("")),
27            Style::default().bg(Color::Yellow).fg(Color::Black),
28        ),
29    }
30}