use crate::CursorShape;
use crate::style::{Color, Style};
use std::time::Duration;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct StyleState {
pub text: Style,
pub placeholder: Style,
pub suggestion: Style,
pub prompt: Style,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct CursorStyle {
pub color: Color,
pub shape: CursorShape,
pub blink: bool,
pub blink_speed: Duration,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Styles {
pub focused: StyleState,
pub blurred: StyleState,
pub cursor: CursorStyle,
}
impl Styles {
#[must_use]
pub const fn new(is_dark: bool) -> Self {
let subdued = Style::new().fg(Color::Palette(240));
let prompt = Style::new().fg(Color::Ansi(7));
let state = StyleState {
text: Style::new(),
placeholder: subdued,
suggestion: subdued,
prompt,
};
let blurred_text = if is_dark {
Color::Ansi(7)
} else {
Color::Palette(245)
};
Self {
focused: state,
blurred: StyleState {
text: Style::new().fg(blurred_text),
..state
},
cursor: CursorStyle {
color: Color::Ansi(7),
shape: CursorShape::Block,
blink: true,
blink_speed: Duration::ZERO,
},
}
}
}