#[cfg(feature = "matrix")]
mod inner {
use ratatui::{buffer::Buffer, layout::Rect, style::Style};
use tui_matrix::{Rain, draw_pulse};
pub(in crate::tty) use tui_matrix::{
fade_line as style_done_line,
palette::{ACCENT, BAD, DIM, FAINT, GLOW, HOST, REPLY, TEXT as BOLD, THINK, WARN},
};
pub(in crate::tty) const OK: Style = ACCENT;
pub(in crate::tty) const NOTE: Style = WARN;
pub(in crate::tty) fn paint_rain(
zone: Rect,
y_start: u16,
y_end: u16,
buf: &mut Buffer,
frame: usize,
) {
for row in y_start..y_end {
Rain::DEFAULT.draw_row(zone, row, buf, frame);
}
}
pub(in crate::tty) fn draw_waiting(area: Rect, buf: &mut Buffer, seed: u32, frame: usize) {
draw_pulse(area, buf, seed, frame);
}
}
#[cfg(not(feature = "matrix"))]
mod inner {
use std::time::Duration;
use ratatui::{
buffer::Buffer,
layout::Rect,
style::{Color, Modifier, Style},
text::{Line, Span},
widgets::Widget,
};
pub(in crate::tty) const DIM: Style = Style::new().fg(Color::DarkGray);
pub(in crate::tty) const FAINT: Style = Style::new().fg(Color::DarkGray);
pub(in crate::tty) const BOLD: Style = Style::new().add_modifier(Modifier::BOLD);
pub(in crate::tty) const ACCENT: Style = Style::new().fg(Color::Cyan);
pub(in crate::tty) const GLOW: Style = Style::new()
.fg(Color::LightCyan)
.add_modifier(Modifier::BOLD);
pub(in crate::tty) const HOST: Style = Style::new().fg(Color::Cyan).add_modifier(Modifier::BOLD);
pub(in crate::tty) const THINK: Style = DIM;
pub(in crate::tty) const REPLY: Style = Style::new().fg(Color::Green);
pub(in crate::tty) const OK: Style = Style::new().fg(Color::Green);
pub(in crate::tty) const BAD: Style = Style::new().fg(Color::Red);
pub(in crate::tty) const WARN: Style = Style::new().fg(Color::Yellow);
pub(in crate::tty) const NOTE: Style = WARN;
pub(in crate::tty) fn paint_rain(
_zone: Rect,
_y_start: u16,
_y_end: u16,
_buf: &mut Buffer,
_frame: usize,
) {
}
pub(in crate::tty) fn draw_waiting(area: Rect, buf: &mut Buffer, _seed: u32, _frame: usize) {
if area.width > 0 && area.height > 0 {
Span::styled("…", FAINT).render(area, buf);
}
}
pub(in crate::tty) fn style_done_line(
line: Line<'static>,
_rem: Duration,
_window: Duration,
) -> Line<'static> {
line
}
}
pub(super) use inner::{
ACCENT, BAD, BOLD, DIM, FAINT, GLOW, HOST, NOTE, OK, REPLY, THINK, WARN, draw_waiting,
paint_rain, style_done_line,
};