Task

Display a word in various colours on the terminal.

The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.



Optionally demonstrate:

 How the system should determine if the terminal supports colour
 Setting of the background colour
 How to cause blinking or flashing (if supported by the terminal)


const ESC: &str = "\x1B[";
const RESET: &str = "\x1B[0m";
 
fn main() {
    println!("Foreground¦Background--------------------------------------------------------------");
    print!("          ¦");
    for i in 40..48 {
        print!(" ESC[{}m ", i);
    }
    println!("\n----------¦------------------------------------------------------------------------");
    for i in 30..38 {
        print!("{}ESC[{}m   ¦{}{1}m", RESET, i, ESC);
        for j in 40..48 {
            print!("{}{}m Rosetta ", ESC, j);
        }
        println!("{}", RESET);
        print!("{}ESC[{};1m ¦{}{1};1m", RESET, i, ESC);
        for j in 40..48 {
            print!("{}{}m Rosetta ", ESC, j);
        }
        println!("{}", RESET);
    }
}