Delete hello_rainbow directory

This commit is contained in:
Dom Sec 2023-03-23 20:53:14 -04:00 committed by GitHub
parent 6a2cd2ae8d
commit 4f5f8efc96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 155 deletions

View File

@ -1,9 +0,0 @@
[package]
name = "hello_rainbow"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
termcolor = "1.2"

View File

@ -1,132 +0,0 @@
use std::io::{Write};
use termcolor::{Color, ColorChoice, ColorSpec, WriteColor, StandardStream};
pub fn print_green(text: &str) {
// Create a color specification for green
let mut spec = ColorSpec::new();
spec.set_fg(Some(Color::Green));
// Create a standard stream for writing to the console
let mut stdout = StandardStream::stdout(ColorChoice::Always);
// Write the text to the console with the green color
stdout.set_color(&spec).unwrap();
writeln!(&mut stdout, "{}", text).unwrap();
// Reset the color specification to the default
stdout.reset().unwrap();
}
pub fn print_black(text: &str) {
// Create a color specification for black
let mut spec = ColorSpec::new();
spec.set_fg(Some(Color::Black));
// Create a standard stream for writing to the console
let mut stdout = StandardStream::stdout(ColorChoice::Always);
// Write the text to the console with the green color
stdout.set_color(&spec).unwrap();
writeln!(&mut stdout, "{}", text).unwrap();
// Reset the color specification to the default
stdout.reset().unwrap();
}
pub fn print_blue(text: &str) {
// Create a color specification for blue
let mut spec = ColorSpec::new();
spec.set_fg(Some(Color::Blue));
// Create a standard stream for writing to the console
let mut stdout = StandardStream::stdout(ColorChoice::Always);
// Write the text to the console with the green color
stdout.set_color(&spec).unwrap();
writeln!(&mut stdout, "{}", text).unwrap();
// Reset the color specification to the default
stdout.reset().unwrap();
}
pub fn print_red(text: &str) {
// Create a color specification for red
let mut spec = ColorSpec::new();
spec.set_fg(Some(Color::Red));
// Create a standard stream for writing to the console
let mut stdout = StandardStream::stdout(ColorChoice::Always);
// Write the text to the console with the green color
stdout.set_color(&spec).unwrap();
writeln!(&mut stdout, "{}", text).unwrap();
// Reset the color specification to the default
stdout.reset().unwrap();
}
pub fn print_cyan(text: &str) {
// Create a color specification for cyan
let mut spec = ColorSpec::new();
spec.set_fg(Some(Color::Cyan));
// Create a standard stream for writing to the console
let mut stdout = StandardStream::stdout(ColorChoice::Always);
// Write the text to the console with the green color
stdout.set_color(&spec).unwrap();
writeln!(&mut stdout, "{}", text).unwrap();
// Reset the color specification to the default
stdout.reset().unwrap();
}
pub fn print_magenta(text: &str) {
// Create a color specification for magenta
let mut spec = ColorSpec::new();
spec.set_fg(Some(Color::Magenta));
// Create a standard stream for writing to the console
let mut stdout = StandardStream::stdout(ColorChoice::Always);
// Write the text to the console with the green color
stdout.set_color(&spec).unwrap();
writeln!(&mut stdout, "{}", text).unwrap();
// Reset the color specification to the default
stdout.reset().unwrap();
}
pub fn print_yellow(text: &str) {
// Create a color specification for yellow
let mut spec = ColorSpec::new();
spec.set_fg(Some(Color::Yellow));
// Create a standard stream for writing to the console
let mut stdout = StandardStream::stdout(ColorChoice::Always);
// Write the text to the console with the green color
stdout.set_color(&spec).unwrap();
writeln!(&mut stdout, "{}", text).unwrap();
// Reset the color specification to the default
stdout.reset().unwrap();
}
pub fn print_white(text: &str) {
// Create a color specification for white
let mut spec = ColorSpec::new();
spec.set_fg(Some(Color::White));
// Create a standard stream for writing to the console
let mut stdout = StandardStream::stdout(ColorChoice::Always);
// Write the text to the console with the green color
stdout.set_color(&spec).unwrap();
writeln!(&mut stdout, "{}", text).unwrap();
// Reset the color specification to the default
stdout.reset().unwrap();
}

View File

@ -1,14 +0,0 @@
mod colors;
fn main() {
colors::print_black("Hello Black!");
colors::print_blue("Hello Blue!");
colors::print_green("Hello Green!");
colors::print_red("Hello Red!");
colors::print_cyan("Hello Cyan!");
colors::print_magenta("Hello Magenta!");
colors::print_yellow("Hello Yellow!");
colors::print_white("Hello White!");
}