Crate colour [] [src]

Macros for creating coloured console output.

The macros are based on the following colours:

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

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

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

Internally, the macros use a global static handle to stdout which is locked on each call. At the end of each call, stdout is flushed. This results in slower performance compared to print! or println!, but avoids interleaving of the output in a multi-threaded environment.

Macros

black

Macro similar to print! using black as the foreground colour.

black_ln

Macro similar to println! using black as the foreground colour.

blue

Macro similar to print! using blue as the foreground colour.

blue_ln

Macro similar to println! using blue as the foreground colour.

cyan

Macro similar to print! using cyan as the foreground colour.

cyan_ln

Macro similar to println! using cyan as the foreground colour.

dark_black

Macro similar to print! using dark black as the foreground colour.

dark_black_ln

Macro similar to println! using dark black as the foreground colour.

dark_blue

Macro similar to print! using dark blue as the foreground colour.

dark_blue_ln

Macro similar to println! using dark blue as the foreground colour.

dark_cyan

Macro similar to print! using dark cyan as the foreground colour.

dark_cyan_ln

Macro similar to println! using dark cyan as the foreground colour.

dark_green

Macro similar to print! using dark green as the foreground colour.

dark_green_ln

Macro similar to println! using dark green as the foreground colour.

dark_magenta

Macro similar to print! using dark magenta as the foreground colour.

dark_magenta_ln

Macro similar to println! using dark magenta as the foreground colour.

dark_red

Macro similar to print! using dark red as the foreground colour.

dark_red_ln

Macro similar to println! using dark red as the foreground colour.

dark_white

Macro similar to print! using dark white as the foreground colour.

dark_white_ln

Macro similar to println! using dark white as the foreground colour.

dark_yellow

Macro similar to print! using dark yellow as the foreground colour.

dark_yellow_ln

Macro similar to println! using dark yellow as the foreground colour.

green

Macro similar to print! using green as the foreground colour.

green_ln

Macro similar to println! using green as the foreground colour.

magenta

Macro similar to print! using magenta as the foreground colour.

magenta_ln

Macro similar to println! using magenta as the foreground colour.

prnt

Macro similar to print! using the current default foreground colour.

prnt_ln

Macro similar to println! using the current default foreground colour.

red

Macro similar to print! using red as the foreground colour.

red_ln

Macro similar to println! using red as the foreground colour.

white

Macro similar to print! using white as the foreground colour.

white_ln

Macro similar to println! using white as the foreground colour.

yellow

Macro similar to print! using yellow as the foreground colour.

yellow_ln

Macro similar to println! using yellow as the foreground colour.