Crate line_ui

Crate line_ui 

Source
Expand description

§line-ui

Line-based TUI library, using termion.

§Example

use line_ui::{Renderer, Style};
use line_ui::element::*;
use termion::input::TermRead;
use termion::raw::IntoRawMode;

fn main() -> std::io::Result<()> {
    let stdout = std::io::stdout().into_raw_mode()?;
    let mut r = Renderer::new(stdout);

    r.reset()?
        .render((
            "left".into_element(),
            "fixed width".fixed_width(20).styled(Style::INVERT),
            "right".into_element(),
        ))?
        .render("Press any key to continue!".into_element())?
        .finish()?;

    let _ = std::io::stdin().events().next();
    Ok(())
}

§License

MIT

Modules§

element
The Element trait, and various elements.

Structs§

Renderer
A struct that outputs lines to a writer.
Style
A text style, encompassing the color and other style options.

Enums§

Color
A terminal color, which can be applied to the foreground or background.