6 releases

0.1.5 Nov 17, 2020
0.1.4 Nov 17, 2020

#7 in #rainbow

30 downloads per month

MIT license

5KB
76 lines

Rainbow

A crate for writing text in rainbow colors.

Examples

Write text with foreground colors

use rainbow_text::Rainbow;

fn main() -> std::io::Result<()>
{
    let rain = Rainbow::default();
    
    rain.write("Hello, World")?;
    
    Ok(())
}

Write text with background colors

use rainbow_text::Rainbow;

fn main() -> std::io::Result<()>
{
    let rain = Rainbow::default();
    
    rain.write_bg("Hello, World")?;
    
    Ok(())
}

Custom Rainbows!

use rainbow_text::{ Rainbow, Color };

fn main() -> std::io::Result<()>
{
    let rain = Rainbow::custom(
        vec![
            Color::Rgb(255,0,0),
            Color::Rgb(0,255,0),
            Color::Rgb(0,0,255),
        ]
    );
    
    rain.write("Hello, World")?;
    
    Ok(())
}

Dependencies

~0–6.5MB
~38K SLoC