ansic/lib.rs
1#![no_std]
2
3/// Contains optional utilities like vt_mode!() and styled!()
4#[cfg(feature = "utils")]
5pub mod utils;
6
7/// # The ansi! macro
8///
9/// The proc macro directly returns the harcoded string result of the DSL syntax and styling you provided fully at compile time.
10///
11/// Syntax:
12///
13/// Each styling argument is passed to the ansi macro separated by a space as such:
14/// ```rust
15/// ansi!(red bold);
16/// ```
17///
18/// Each styling argument (which has a color target) may also have any combination of these arguments:
19/// - "br" - sets the target as a bright color
20/// - "bg" - sets the color as the background color
21///
22/// Example with a red bright background and a bold style:
23/// ```rust
24/// ansi!(bg.br.red bold);
25/// ```
26///
27/// (foreground is the default of written colors so to specify a red foreground you can just write "red")
28///
29/// We also Support rgb with the rgb(r, g, b) syntax like this:
30/// ```rust
31/// ansi!(rgb(255, 34, 55));
32/// ```
33///
34/// Idiomatic ansic syntax is also storing styles in constants and using them to style in a much less verbose way:
35/// ```rust
36/// const ERROR: &str = ansi!(br.red bold underline italic);
37/// const RESET: &str = ansi!(reset);
38///
39/// fn main() {
40/// println!("{ERROR}[ERROR]: Hello, world!{RESET}");
41/// }
42/// ```
43///
44/// Rgb colors may also take bg as an argument but br won't have an effect
45/// ```rust
46/// ansi!(bg.rgb(255, 34, 55))
47/// ```
48///
49/// ## All styles (doesnt support any arguments):
50/// - reset
51/// - bold
52/// - dim
53/// - italic
54/// - underline
55/// - blink
56/// - rapidblink (mostly deprecated)
57/// - invert
58/// - hidden
59/// - strikethrough (has alias: st)
60///
61/// ## All colors (supports br and bg arguments):
62/// - black
63/// - red
64/// - green
65/// - yellow
66/// - blue
67/// - magenta
68/// - cyan
69/// - white
70///
71/// Rgb color 24 bits (supports bg argument):
72/// - rgb(r, g, b)
73pub use ansic_macros::ansi;