Skip to main content

jt_consoleutils/
colors.rs

1//! Raw ANSI escape-code constants for terminal text styling.
2//!
3//! These are the building blocks used throughout the crate whenever colored or
4//! styled output is written directly. Import the constants you need and embed
5//! them in format strings:
6//!
7//! ```rust
8//! use jt_consoleutils::colors::{GREEN, RESET};
9//! println!("{GREEN}success{RESET}");
10//! ```
11
12/// Resets all active ANSI text attributes (color, bold, dim, etc.).
13pub const RESET: &str = "\x1b[0m";
14
15/// Bold / increased intensity text.
16pub const BOLD: &str = "\x1b[1m";
17
18/// Dim / decreased intensity text.
19pub const DIM: &str = "\x1b[2m";
20
21/// Red foreground color.
22pub const RED: &str = "\x1b[31m";
23
24/// Green foreground color.
25pub const GREEN: &str = "\x1b[32m";
26
27/// Yellow foreground color.
28pub const YELLOW: &str = "\x1b[33m";
29
30/// Cyan foreground color.
31pub const CYAN: &str = "\x1b[36m";