Skip to content

Commit 559cc29

Browse files
committed
Added colors to the output.
1 parent 66287e5 commit 559cc29

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use clap::Parser;
22
use regex::Regex;
33
use std::i64;
4+
use colored::Colorize;
45

56
const HEX_PATTERN: &str = r"^0x[0-9a-fA-F]+$";
67
const DEC_PATTERN: &str = r"^-?[0-9]+$";
@@ -23,9 +24,9 @@ fn main() {
2324
}
2425

2526
fn display_number_formats(value: i64) {
26-
println!("{}", FORMAT_DEC.replace("{:#}", &value.to_string()));
27-
println!("{}", FORMAT_HEX.replace("{:#x}", &format!("{:#x}", value)));
28-
println!("{}", FORMAT_BIN.replace("{:#b}", &format!("{:#b}", value)));
27+
println!("{}", FORMAT_DEC.replace("{:#}", &value.to_string()).bright_green());
28+
println!("{}", FORMAT_HEX.replace("{:#x}", &format!("{:#x}", value)).bright_cyan());
29+
println!("{}", FORMAT_BIN.replace("{:#b}", &format!("{:#b}", value)).bright_magenta());
2930
}
3031

3132
fn handle_parse_error(error: anyhow::Error) -> ! {

0 commit comments

Comments
 (0)