use crate::theme::Bg;
use ratatui::style::Style;
use ratatui::text::Span;
use crate::ui::Ctx;
pub fn chip<'a>(ctx: Ctx<'_>, text: impl Into<String>, style: Style, parent: Bg) -> Vec<Span<'a>> {
let text = text.into();
match (ctx.icons.chip_caps(), style.bg) {
(Some((left, right)), Some(chip_bg)) => {
let cap = Style::new().fg(chip_bg).bg(ctx.theme.bg_color(parent));
vec![
Span::styled(left, cap),
Span::styled(text, style),
Span::styled(right, cap),
]
}
_ => vec![Span::styled(format!(" {text} "), style)],
}
}
pub fn reaction_fill(mine: bool) -> Bg {
if mine {
Bg::PrimaryContainer
} else {
Bg::ContainerHighest
}
}