1pub struct Icons {
8 pub running: &'static str,
9 pub done: &'static str,
10 pub planned: &'static str,
11 pub failed: &'static str,
12 pub download: &'static str,
13 pub upload: &'static str,
14 pub clock: &'static str,
15 pub estimate: &'static str,
16 pub summary: &'static str,
17}
18
19pub static UNICODE: Icons = Icons {
21 running: "⏵",
22 done: "✔",
23 planned: "⏸",
24 failed: "✗",
25 download: "↓",
26 upload: "↑",
27 clock: "⏱",
28 estimate: "∅",
29 summary: "∑",
30};
31
32pub static NERD: Icons = Icons {
38 running: "\u{f04b}", done: "\u{f00c}", planned: "\u{f04c}", failed: "\u{f071}", download: "\u{f063}", upload: "\u{f062}", clock: "\u{f1da}", estimate: "\u{f252}", summary: "\u{f04a0}", };
48
49pub fn detect() -> &'static Icons {
54 if let Ok(v) = std::env::var("NERD_FONTS") {
56 match v.trim() {
57 "1" | "true" | "yes" => return &NERD,
58 "0" | "false" | "no" => return &UNICODE,
59 _ => {},
60 }
61 }
62
63 let vars: Vec<(String, String)> = std::env::vars().collect();
64 match has_nerd_font::detect(&vars).detected {
65 Some(true) => &NERD,
66 _ => &UNICODE,
67 }
68}