velocity 0.1.2

A next level TUI Library
Documentation
pub trait Paint {
    fn red(&self) -> String;
    fn green(&self) -> String;
    fn yellow(&self) -> String;
    fn blue(&self) -> String;
    fn magenta(&self) -> String;
    fn cyan(&self) -> String;
    fn white(&self) -> String;
    fn gray(&self) -> String;
    fn bright_red(&self) -> String;
    fn bright_green(&self) -> String;
    fn bright_yellow(&self) -> String;
    fn bright_blue(&self) -> String;
    fn bright_magenta(&self) -> String;
    fn bright_cyan(&self) -> String;
    fn bright_white(&self) -> String;

    fn underline(&self) -> String;
    fn bold(&self) -> String;
    fn italic(&self) -> String;
    fn strikethrough(&self) -> String;

    fn black_bg(&self) -> String;
    fn red_bg(&self) -> String;
    fn green_bg(&self) -> String;
    fn yellow_bg(&self) -> String;
    fn blue_bg(&self) -> String;
    fn magenta_bg(&self) -> String;
    fn cyan_bg(&self) -> String;
    fn white_bg(&self) -> String;
    fn gray_bg(&self) -> String;
    fn bright_red_bg(&self) -> String;
    fn bright_green_bg(&self) -> String;
    fn bright_yellow_bg(&self) -> String;
    fn bright_blue_bg(&self) -> String;
    fn bright_magenta_bg(&self) -> String;
    fn bright_cyan_bg(&self) -> String;
    fn bright_white_bg(&self) -> String;
    fn reset(&self) -> String;
}

impl Paint for String {
    fn red(&self) -> String {
        format!("\x1b[31m{}", self)
    }

    fn green(&self) -> String {
        format!("\x1b[32m{}", self)
    }

    fn yellow(&self) -> String {
        format!("\x1b[33m{}", self)
    }

    fn blue(&self) -> String {
        format!("\x1b[34m{}", self)
    }

    fn magenta(&self) -> String {
        format!("\x1b[35m{}", self)
    }

    fn cyan(&self) -> String {
        format!("\x1b[36m{}", self)
    }

    fn white(&self) -> String {
        format!("\x1b[37m{}", self)
    }

    fn gray(&self) -> String {
        format!("\x1b[90m{}", self)
    }

    fn bright_red(&self) -> String {
        format!("\x1b[91m{}", self)
    }

    fn bright_green(&self) -> String {
        format!("\x1b[92m{}", self)
    }

    fn bright_yellow(&self) -> String {
        format!("\x1b[93m{}", self)
    }

    fn bright_blue(&self) -> String {
        format!("\x1b[94m{}", self)
    }

    fn bright_magenta(&self) -> String {
        format!("\x1b[95m{}", self)
    }

    fn bright_cyan(&self) -> String {
        format!("\x1b[96m{}", self)
    }

    fn bright_white(&self) -> String {
        format!("\x1b[97m{}", self)
    }

    fn underline(&self) -> String {
        format!("\x1b[4m{}", self)
    }

    fn bold(&self) -> String {
        format!("\x1b[1m{}", self)
    }

    fn italic(&self) -> String {
        format!("\x1b[3m{}", self)
    }

    fn strikethrough(&self) -> String {
        format!("\x1b[9m{}", self)
    }

    fn black_bg(&self) -> String {
        format!("\x1b[40m{}", self)
    }

    fn red_bg(&self) -> String {
        format!("\x1b[41m{}", self)
    }

    fn green_bg(&self) -> String {
        format!("\x1b[42m{}", self)
    }

    fn yellow_bg(&self) -> String {
        format!("\x1b[43m{}", self)
    }

    fn blue_bg(&self) -> String {
        format!("\x1b[44m{}", self)
    }

    fn magenta_bg(&self) -> String {
        format!("\x1b[45m{}", self)
    }

    fn cyan_bg(&self) -> String {
        format!("\x1b[46m{}", self)
    }

    fn white_bg(&self) -> String {
        format!("\x1b[47m{}", self)
    }

    fn gray_bg(&self) -> String {
        format!("\x1b[100m{}", self)
    }

    fn bright_red_bg(&self) -> String {
        format!("\x1b[101m{}", self)
    }

    fn bright_green_bg(&self) -> String {
        format!("\x1b[102m{}", self)
    }

    fn bright_yellow_bg(&self) -> String {
        format!("\x1b[103m{}", self)
    }

    fn bright_blue_bg(&self) -> String {
        format!("\x1b[104m{}", self)
    }

    fn bright_magenta_bg(&self) -> String {
        format!("\x1b[105m{}", self)
    }

    fn bright_cyan_bg(&self) -> String {
        format!("\x1b[106m{}", self)
    }

    fn bright_white_bg(&self) -> String {
        format!("\x1b[107m{}", self)
    }

    fn reset(&self) -> String {
        format!("\x1b[0m{}", self)
    }
}

impl<'a> Paint for &'a str {
    fn red(&self) -> String {
        format!("\x1b[31m{}", self)
    }

    fn green(&self) -> String {
        format!("\x1b[32m{}", self)
    }

    fn yellow(&self) -> String {
        format!("\x1b[33m{}", self)
    }

    fn blue(&self) -> String {
        format!("\x1b[34m{}", self)
    }

    fn magenta(&self) -> String {
        format!("\x1b[35m{}", self)
    }

    fn cyan(&self) -> String {
        format!("\x1b[36m{}", self)
    }

    fn white(&self) -> String {
        format!("\x1b[37m{}", self)
    }

    fn gray(&self) -> String {
        format!("\x1b[90m{}", self)
    }

    fn bright_red(&self) -> String {
        format!("\x1b[91m{}", self)
    }

    fn bright_green(&self) -> String {
        format!("\x1b[92m{}", self)
    }

    fn bright_yellow(&self) -> String {
        format!("\x1b[93m{}", self)
    }

    fn bright_blue(&self) -> String {
        format!("\x1b[94m{}", self)
    }

    fn bright_magenta(&self) -> String {
        format!("\x1b[95m{}", self)
    }

    fn bright_cyan(&self) -> String {
        format!("\x1b[96m{}", self)
    }

    fn bright_white(&self) -> String {
        format!("\x1b[97m{}", self)
    }

    fn underline(&self) -> String {
        format!("\x1b[4m{}", self)
    }

    fn bold(&self) -> String {
        format!("\x1b[1m{}", self)
    }

    fn italic(&self) -> String {
        format!("\x1b[3m{}", self)
    }

    fn strikethrough(&self) -> String {
        format!("\x1b[9m{}", self)
    }

    fn black_bg(&self) -> String {
        format!("\x1b[40m{}", self)
    }

    fn red_bg(&self) -> String {
        format!("\x1b[41m{}", self)
    }

    fn green_bg(&self) -> String {
        format!("\x1b[42m{}", self)
    }

    fn yellow_bg(&self) -> String {
        format!("\x1b[43m{}", self)
    }

    fn blue_bg(&self) -> String {
        format!("\x1b[44m{}", self)
    }

    fn magenta_bg(&self) -> String {
        format!("\x1b[45m{}", self)
    }

    fn cyan_bg(&self) -> String {
        format!("\x1b[46m{}", self)
    }

    fn white_bg(&self) -> String {
        format!("\x1b[47m{}", self)
    }

    fn gray_bg(&self) -> String {
        format!("\x1b[100m{}", self)
    }

    fn bright_red_bg(&self) -> String {
        format!("\x1b[101m{}", self)
    }

    fn bright_green_bg(&self) -> String {
        format!("\x1b[102m{}", self)
    }

    fn bright_yellow_bg(&self) -> String {
        format!("\x1b[103m{}", self)
    }

    fn bright_blue_bg(&self) -> String {
        format!("\x1b[104m{}", self)
    }

    fn bright_magenta_bg(&self) -> String {
        format!("\x1b[105m{}", self)
    }

    fn bright_cyan_bg(&self) -> String {
        format!("\x1b[106m{}", self)
    }

    fn bright_white_bg(&self) -> String {
        format!("\x1b[107m{}", self)
    }

    fn reset(&self) -> String {
        format!("\x1b[0m{}", self)
    }
}