1use is_unicode_supported::is_unicode_supported;
4use once_cell::sync::Lazy;
5
6pub(crate) static IS_UNICODE: Lazy<bool> = Lazy::new(is_unicode_supported);
7
8fn is_unicode(unicode: &'static str, non_unicode: &'static str) -> &'static str {
9 if *IS_UNICODE {
10 unicode
11 } else {
12 non_unicode
13 }
14}
15
16pub mod chars {
20 use super::is_unicode;
21 use once_cell::sync::Lazy;
22
23 pub static BAR: Lazy<&str> = Lazy::new(|| is_unicode("│", "|"));
25 pub static BAR_START: Lazy<&str> = Lazy::new(|| is_unicode("┌", "T"));
27 pub static BAR_END: Lazy<&str> = Lazy::new(|| is_unicode("└", "—"));
29 pub static STEP_ACTIVE: Lazy<&str> = Lazy::new(|| is_unicode("◆", "*"));
31 pub static STEP_CANCEL: Lazy<&str> = Lazy::new(|| is_unicode("■", "x"));
33 pub static STEP_ERROR: Lazy<&str> = Lazy::new(|| is_unicode("▲", "x"));
35 pub static STEP_SUBMIT: Lazy<&str> = Lazy::new(|| is_unicode("◇", "o"));
37 pub static RADIO_ACTIVE: Lazy<&str> = Lazy::new(|| is_unicode("●", ">"));
39 pub static RADIO_INACTIVE: Lazy<&str> = Lazy::new(|| is_unicode("○", " "));
41 pub static CHECKBOX_ACTIVE: Lazy<&str> = Lazy::new(|| is_unicode("◻", "[.]"));
43 pub static CHECKBOX_SELECTED: Lazy<&str> = Lazy::new(|| is_unicode("◼", "[+]"));
45 pub static CHECKBOX_INACTIVE: Lazy<&str> = Lazy::new(|| is_unicode("◻", "[ ]"));
47}
48
49pub mod ansi {
51 pub const CLEAR_LINE: &str = "\x1b[2K";
53}