zellij_tile_utils/
lib.rs

1#[macro_export]
2macro_rules! rgb {
3    ($a:expr) => {
4        ansi_term::Color::Rgb($a.0, $a.1, $a.2)
5    };
6}
7
8#[macro_export]
9macro_rules! palette_match {
10    ($palette_color:expr) => {
11        match $palette_color {
12            PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
13            PaletteColor::EightBit(color) => Fixed(color),
14        }
15    };
16}
17
18#[macro_export]
19macro_rules! style {
20    ($fg:expr, $bg:expr) => {
21        ansi_term::Style::new()
22            .fg(match $fg {
23                PaletteColor::Rgb((r, g, b)) => ansi_term::Color::RGB(r, g, b),
24                PaletteColor::EightBit(color) => ansi_term::Color::Fixed(color),
25            })
26            .on(match $bg {
27                PaletteColor::Rgb((r, g, b)) => ansi_term::Color::RGB(r, g, b),
28                PaletteColor::EightBit(color) => ansi_term::Color::Fixed(color),
29            })
30    };
31}