[][src]Crate colol

Colol is a supersimple terminal color library. It's almost completely macro based, and has little overhead. the things that you'll be seing the most of are two macros and an initialisation function. All you'll ever need to do with the init function is colol::init();. The first macro, color!, sets the color or formatting of the terminal. For example:

color!(red);
println!("Red text!");
color!(reset);

However, you may find that you don't want to reset everything to default. This is where the second macro comes in: close_color!. This will reset only a specific formatting. For example:

color!(red);
color!(bg_green);
println!("Red text with a green background!");
close_color!(bg_green);
println!("Red text with no green background!");
close_color!(red);

Pretty good!

The reason this has an advantage over the multitude of other terminal color crates out there is that this is significantly more lightweight, and does not incur much runtime cost at all. It is also useful for when you are printing out large amounts of individual strings, like so:

color!(red);
loopn!(5, {
    println!("Hello world!");
});
close_color!(red);

For a list of colors, see colors::COLORS.

Modules

colors

See const COLORS for a list of all the colors. Other than that, his module contains internals.

Macros

close_color
color

Functions

init