use crate::envman::get_env;
pub fn should_have_color_support() -> bool {
termion::is_tty(&mut std::io::stdout()) && get_env("NO_COLOR").len() == 0
}
pub struct ChromeInstance {
color_is_supported: bool,
}
impl ChromeInstance {
pub fn get_green(&mut self) -> &'static str {
if self.color_is_supported {
"\x1b[38;2;60;174;163m"
} else {
""
}
}
pub fn get_red(&mut self) -> &'static str {
if self.color_is_supported {
"\x1b[38;2;220;50;47m"
} else {
""
}
}
pub fn get_grey(&mut self) -> &'static str {
if self.color_is_supported {
"\x1b[38;2;68;68;68m"
} else {
""
}
}
pub fn get_reset(&mut self) -> &'static str {
if self.color_is_supported {
"\x1b[39m"
} else {
""
}
}
pub fn new(color_is_supported: bool) -> ChromeInstance {
ChromeInstance { color_is_supported }
}
}