use colored::Colorize;
pub const ICON_CRITICAL: &str = "✗";
pub const ICON_HIGH: &str = "✗";
pub const ICON_MEDIUM: &str = "⚠";
pub const ICON_LOW: &str = "ℹ";
pub const ICON_PASS: &str = "✓";
#[allow(dead_code)]
pub const ICON_SUPPRESS: &str = "○";
pub const ICON_ARROW: &str = "→";
#[allow(dead_code)]
pub const ICON_BULLET: &str = "·";
#[allow(dead_code)]
pub const ICON_BOX_H: &str = "─";
#[allow(dead_code)]
pub const ICON_BOX_V: &str = "│";
#[allow(dead_code)]
pub const ICON_BOX_TL: &str = "╭";
#[allow(dead_code)]
pub const ICON_BOX_TR: &str = "╮";
#[allow(dead_code)]
pub const ICON_BOX_BL: &str = "╰";
#[allow(dead_code)]
pub const ICON_BOX_BR: &str = "╯";
#[allow(dead_code)]
pub const ICON_BOX_ML: &str = "├";
#[allow(dead_code)]
pub const ICON_BOX_MR: &str = "┤";
pub const SPINNER_FRAMES: &[&str] = &["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
const BRAND_R: u8 = 0x34;
const BRAND_G: u8 = 0xD3;
const BRAND_B: u8 = 0x99;
fn supports_truecolor() -> bool {
std::env::var("COLORTERM")
.map(|v| v.contains("truecolor") || v.contains("24bit"))
.unwrap_or(false)
}
fn brand(s: &str) -> colored::ColoredString {
if supports_truecolor() {
s.truecolor(BRAND_R, BRAND_G, BRAND_B)
} else {
s.green()
}
}
pub fn color_critical(s: &str) -> String {
s.bright_red().bold().to_string()
}
pub fn color_high(s: &str) -> String {
s.red().bold().to_string()
}
pub fn color_medium(s: &str) -> String {
s.yellow().bold().to_string()
}
pub fn color_low(s: &str) -> String {
s.cyan().bold().to_string()
}
pub fn color_success(s: &str) -> String {
s.bright_green().bold().to_string()
}
pub fn color_failure(s: &str) -> String {
s.bright_red().bold().to_string()
}
#[allow(dead_code)]
pub fn color_warning(s: &str) -> String {
s.yellow().to_string()
}
#[allow(dead_code)]
pub fn color_skipped(s: &str) -> String {
s.white().dimmed().to_string()
}
pub fn color_border(s: &str) -> String {
s.white().dimmed().to_string()
}
pub fn color_label(s: &str) -> String {
s.white().bold().to_string()
}
pub fn color_value(s: &str) -> String {
s.white().to_string()
}
pub fn color_dim(s: &str) -> String {
s.dimmed().to_string()
}
#[allow(dead_code)]
pub fn color_accent(s: &str) -> String {
brand(s).to_string()
}
pub fn color_recommendation(s: &str) -> String {
s.italic().cyan().to_string()
}
pub fn color_header(s: &str) -> String {
brand(s).bold().to_string()
}