Skip to content

Commit

Permalink
feat: add colors to shell output using \ansi_term\ crate
Browse files Browse the repository at this point in the history
  • Loading branch information
raghav-rama committed Mar 28, 2024
1 parent 0602ab3 commit 5e9eda4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ tokio = { version = "1.36.0", features = ["full"] }
sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git" }
sp1-core = { git = "https://github.com/succinctlabs/sp1.git" }
num = "0.4"
ansi_term = "0.12.1"
17 changes: 17 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
use ansi_term::Colour::{Blue, Cyan, Green, Purple, Red, Yellow};
use ansi_term::Style;

fn main() {
println!("Hello, this is collection of rust stuff!");
println!("Feel free to look in the bin folder and explore all the cool stuff");
Expand All @@ -13,4 +16,18 @@ fn main() {
"{}hi{} there, {}this{} is a {}cool{} message",
c.1, c.0, c.2, c.0, c.3, c.0
);
let mut style = Style::new();
style.bold();
style.underline();
style.background = Some(Blue);
println!(
"{}{}{}{}{}{}{}",
Blue.paint("Hi"),
Green.paint(" there"),
Red.paint(" this"),
Yellow.paint(" is"),
Cyan.paint(" a"),
Purple.paint(" cool message\n"),
style.paint("Rust is fookin' awesome!")
);
}

0 comments on commit 5e9eda4

Please sign in to comment.