Crate colour

source ·
Expand description

Macros for creating coloured console output.

The macros are based on the following colours:

  • grey
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • black
  • white

To view the colour palette, run:

cargo test print_stdout_no_newline

There are dark versions of each colour except black and white, and for all colours there is a version with suffix _ln which appends a newline (similar to print! and println!).

Every variant also has a version with prefix e_. Variants with this prefix output to stderr, while those without the e_ prefix output to stdout.

Every variant also has a version with prefix write_. Variants with this prefix output to a provided buffer, where the buffer implements std::io::Write (similar to write! and writeln!).

There are also prnt!, prnt_ln!, wrte! and wrte_ln! available which print using the current default foreground colour.

Macros§