egui_simple_term 0.1.0

A small embeddable terminal widget for egui: a colored prompt, line editing, command history, and a scrollable output backlog.
Documentation
use eframe::egui::Color32;

const CURSOR_COLOR: Color32 = Color32::from_rgba_unmultiplied_const(255, 255, 255, 128);
const PROMPT_COLOR: Color32 = Color32::GREEN;
const RECORD_COLOR: Color32 = Color32::WHITE;

/// A terminal's color scheme — one color per visible part.
///
/// ```text
/// ┌──────────────────────────────────────────┐
/// │ output line one                          │
/// │ output line two                          │
/// │ > hello world█                           │
/// └──────────────────────────────────────────┘
/// ```
///
/// - `prompt_color` — the leading prompt (the `> ` above).
/// - `record_color` — **both** the text you type (`hello world`) **and** the
///   output written by [`Terminal::writeln_grid`](crate::Terminal::writeln_grid)
///   (`output line one`, …).
/// - `cursor_color` — the block cursor (`█`), drawn only while the terminal has
///   focus.
#[derive(Clone, Copy)]
pub struct Palette {
    /// Color of the block cursor.
    pub cursor_color: Color32,
    /// Color of the prompt text.
    pub prompt_color: Color32,
    /// Color of both the typed input and the output backlog.
    pub record_color: Color32,
}

/// The default scheme: a translucent white cursor, a green prompt, and white text.
impl Default for Palette {
    fn default() -> Self {
        Self {
            cursor_color: CURSOR_COLOR,
            prompt_color: PROMPT_COLOR,
            record_color: RECORD_COLOR,
        }
    }
}