use ratatui::style::Color;
pub mod alacritty;
pub mod converter;
pub mod opencode;
pub mod theme_pack;
pub use converter::{convert_alacritty_toml, convert_opencode_json};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Variant {
Dark,
Light,
}
#[derive(Debug, Clone)]
pub struct SourcePalette {
pub bg: Color,
pub fg: Color,
pub black: Color,
pub red: Color,
pub green: Color,
pub yellow: Color,
pub blue: Color,
pub magenta: Color,
pub cyan: Color,
pub white: Color,
pub bright_black: Color,
pub bright_red: Color,
pub bright_green: Color,
pub bright_yellow: Color,
pub bright_blue: Color,
pub bright_magenta: Color,
pub bright_cyan: Color,
pub bright_white: Color,
pub accent: Option<Color>,
pub purple: Option<Color>,
pub info: Option<Color>,
pub link: Option<Color>,
pub muted: Option<Color>,
pub panel: Option<Color>,
pub element: Option<Color>,
pub selection: Option<Color>,
pub border: Option<Color>,
pub border_subtle: Option<Color>,
}
pub fn mix(a: Color, b: Color, t: f64) -> Color {
let (ar, ag, ab) = match a {
Color::Rgb(r, g, b) => (r, g, b),
_ => return a,
};
let (br, bg_, bb) = match b {
Color::Rgb(r, g, b) => (r, g, b),
_ => return a,
};
let t = t.clamp(0.0, 1.0);
let lerp = |x: u8, y: u8| -> u8 { (f64::from(x) * (1.0 - t) + f64::from(y) * t).round() as u8 };
Color::Rgb(lerp(ar, br), lerp(ag, bg_), lerp(ab, bb))
}
pub(crate) const XTERM16: [(u8, u8, u8); 16] = [
(0x00, 0x00, 0x00),
(0xcd, 0x00, 0x00),
(0x00, 0xcd, 0x00),
(0xcd, 0xcd, 0x00),
(0x00, 0x00, 0xee),
(0xcd, 0x00, 0xcd),
(0x00, 0xcd, 0xcd),
(0xe5, 0xe5, 0xe5),
(0x7f, 0x7f, 0x7f),
(0xff, 0x00, 0x00),
(0x00, 0xff, 0x00),
(0xff, 0xff, 0x00),
(0x5c, 0x5c, 0xff),
(0xff, 0x00, 0xff),
(0x00, 0xff, 0xff),
(0xff, 0xff, 0xff),
];