data_beans/figure/term.rs
1//! Figures drawn as images inside the full-screen views, in terminals that
2//! speak an image protocol (kitty, iTerm2, WezTerm, Ghostty, sixel):
3//! legume-tui's (`legume_tui::graphics::figure`), asked for as
4//! `DATA_BEANS_TUI_IMAGES` says. Elsewhere the views keep their text plots.
5
6pub use legume_tui::graphics::figure::PlotImage;
7use ratatui_image::picker::Picker;
8
9/// The image support of the terminal `session` is attached to now. `None`
10/// without an image protocol, in a terminal not known to have one
11/// (`DATA_BEANS_TUI_IMAGES=1` asks anyway), or with
12/// `DATA_BEANS_TUI_IMAGES=0`. Call it with the screen up, and again after
13/// every attach.
14pub fn picker(session: &legume_tui::Session) -> Option<Picker> {
15 legume_tui::graphics::figure::picker(session, "DATA_BEANS_TUI_IMAGES")
16}