use super::*;
#[macro_export]
macro_rules! hex {
($hex:expr) => {
{
let hex = $hex.trim_start_matches("#");
let r = u8::from_str_radix(&hex[0..2], 16).unwrap();
let g = u8::from_str_radix(&hex[2..4], 16).unwrap();
let b = u8::from_str_radix(&hex[4..6], 16).unwrap();
format!("\x1b[38;2;{};{};{}m", r, g, b)
}
};
}
#[macro_export]
macro_rules! hexbg {
($hex:expr) => {
{
let hex = $hex.trim_start_matches("#");
let r = u8::from_str_radix(&hex[0..2], 16).unwrap();
let g = u8::from_str_radix(&hex[2..4], 16).unwrap();
let b = u8::from_str_radix(&hex[4..6], 16).unwrap();
format!("\x1b[48;2;{};{};{}m\x1b[30m", r, g, b)
}
};
($hex:expr, $r:expr) => {
{
let hex = $hex.trim_start_matches("#");
let r = u8::from_str_radix(&hex[0..2], 16).unwrap();
let g = u8::from_str_radix(&hex[2..4], 16).unwrap();
let b = u8::from_str_radix(&hex[4..6], 16).unwrap();
format!("\x1b[48;2;{};{};{}m\x1b[30m", r, g, b)
}
};
($hex:expr, $r:expr, $g:expr, $b:expr) => {
{
let hex = $hex.trim_start_matches("#");
let r = u8::from_str_radix(&hex[0..2], 16).unwrap();
let g = u8::from_str_radix(&hex[2..4], 16).unwrap();
let b = u8::from_str_radix(&hex[4..6], 16).unwrap();
format!("\x1b[48;2;{};{};{}m\x1b[30m", r, g, b)
}
};
}