logicaffeine_language/
style.rs1pub struct Style;
8
9impl Style {
10 pub const RESET: &'static str = "\x1b[0m";
11 pub const BOLD: &'static str = "\x1b[1m";
12 pub const RED: &'static str = "\x1b[31m";
13 pub const GREEN: &'static str = "\x1b[32m";
14 pub const YELLOW: &'static str = "\x1b[33m";
15 pub const BLUE: &'static str = "\x1b[34m";
16 pub const CYAN: &'static str = "\x1b[36m";
17
18 pub fn red(s: &str) -> String {
19 format!("{}{}{}", Self::RED, s, Self::RESET)
20 }
21
22 pub fn blue(s: &str) -> String {
23 format!("{}{}{}", Self::BLUE, s, Self::RESET)
24 }
25
26 pub fn cyan(s: &str) -> String {
27 format!("{}{}{}", Self::CYAN, s, Self::RESET)
28 }
29
30 pub fn yellow(s: &str) -> String {
31 format!("{}{}{}", Self::YELLOW, s, Self::RESET)
32 }
33
34 pub fn green(s: &str) -> String {
35 format!("{}{}{}", Self::GREEN, s, Self::RESET)
36 }
37
38 pub fn bold(s: &str) -> String {
39 format!("{}{}{}", Self::BOLD, s, Self::RESET)
40 }
41
42 pub fn bold_red(s: &str) -> String {
43 format!("{}{}{}{}", Self::BOLD, Self::RED, s, Self::RESET)
44 }
45}
46
47#[cfg(test)]
48#[path = "../../logicaffeine_tests/unit/logicaffeine_language/style/tests.rs"]
49mod tests;