#[derive(Default)]
pub struct Colors {
pub black: &'static str,
pub red: &'static str,
pub green: &'static str,
pub yellow: &'static str,
pub blue: &'static str,
pub magenta: &'static str,
pub cyan: &'static str,
pub white: &'static str,
pub reset: &'static str,
}
pub const DEFAULT_COLORS: Colors = Colors {
black: "\x1b[90m",
red: "\x1b[91m",
green: "\x1b[92m",
yellow: "\x1b[93m",
blue: "\x1b[94m",
magenta: "\x1b[95m",
cyan: "\x1b[96m",
white: "\x1b[97m",
reset: "\x1b[0m",
};
#[allow(dead_code)]
pub fn replace_default_colors(colors: &mut Colors) {
if colors.black.is_empty() {
colors.black = DEFAULT_COLORS.black;
}
if colors.red.is_empty() {
colors.red = DEFAULT_COLORS.red;
}
if colors.green.is_empty() {
colors.green = DEFAULT_COLORS.green;
}
if colors.yellow.is_empty() {
colors.yellow = DEFAULT_COLORS.yellow;
}
if colors.blue.is_empty() {
colors.blue = DEFAULT_COLORS.blue;
}
if colors.magenta.is_empty() {
colors.magenta = DEFAULT_COLORS.magenta;
}
if colors.cyan.is_empty() {
colors.cyan = DEFAULT_COLORS.cyan;
}
if colors.white.is_empty() {
colors.white = DEFAULT_COLORS.white;
}
if colors.reset.is_empty() {
colors.reset = DEFAULT_COLORS.reset;
}
}