[−][src]Crate sgr_const
A macro to generate SGR (Set Graphic Rendition) control sequences for ECMA-48 compatible terminals.
Examples
The general syntax is:
[visibity] <name> = <attribute> [| attributes...];
You can specify multiple constants at once, as well as add attributes or doc comments to each:
sgr_const::sgr_const! { /// Error styling. Should be flashy. STYLE_ERROR = Bold | BlackFg | RedBg; STYLE_WARN = Bold | YellowFg; STYLE_INFO = Bold | CyanFg; STYLE_DEBUG = MagentaFg; #[allow(unused)] STYLE_TRACE = GreenFg; STYLE_NONE = Reset; } assert_eq!(STYLE_ERROR, "\x1b[1;30;41m"); assert_eq!(STYLE_WARN, "\x1b[1;33m"); assert_eq!(STYLE_INFO, "\x1b[1;36m"); assert_eq!(STYLE_DEBUG, "\x1b[35m"); assert_eq!(STYLE_TRACE, "\x1b[32m"); assert_eq!(STYLE_NONE, "\x1b[0m");
Macros
sgr_const |