[][src]Module tropy::colour

Print coloured output using ANSI escape sequences. The terminal in use must support it.

HSL support is provided by hsl

Example

use tropy::colour::{Rgb,Hsl};
// RGB is not used directly but via the Rgb struct
let red = Rgb(255,0,0);
let green = Rgb(0,255,0);
println!("{}", red.fg("This foreground is red"));
println!("{}", green.bg("This background is green"));
println!("{}", red.fgbg(&green, "The foreground is red and the background is green. Lovely"));
let some_hsl_colour = Hsl{h: 90.0, s : 1.0, l : 0.5};
println!("{}", Rgb::from(some_hsl_colour).fg("This is some HSL colour"));

Structs

Hsl

Color represented in HSL

Rgb

Colour represented as RGB

Enums

RGB

A coloured str (either the character, background or both) when printed to a terminal which supports ANSI escape sequences and 24bit colour codes.