From ffa77a2f60875f7ce9d99acd656e1b368dbd4146 Mon Sep 17 00:00:00 2001 From: fdai7374 Date: Sat, 4 Feb 2023 14:53:52 +0100 Subject: [PATCH] refactoring: add colors for german flag, formatted else --- src/builtins/blahaj.rs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/builtins/blahaj.rs b/src/builtins/blahaj.rs index 6d9c305..fa8af7f 100644 --- a/src/builtins/blahaj.rs +++ b/src/builtins/blahaj.rs @@ -34,9 +34,11 @@ impl Builtin for Blahaj { trans_flag(blahaj); } else if args[0].eq("-p") { pride_flag(blahaj); - }else if args[0].eq("-ger"){ + } else if args[0].eq("-ger") { german(blahaj); - }else {println!("{} is not a valid style for blahaj",args[0])} + } else { + println!("{} is not a valid style for blahaj", args[0]) + } } Ok(()) } @@ -48,7 +50,9 @@ fn trans_flag(blahaj: &str) { println!("{}", lines.truecolor(91, 206, 250));//light blue } else if index % 2 == 0 { println!("{}", lines.white()); - } else { println!("{}", lines.truecolor(245, 169, 184)); }//pink + } else { + println!("{}", lines.truecolor(245, 169, 184));//pink + } } } @@ -73,14 +77,14 @@ fn pride_flag(blahaj: &str) { } } -fn german (blahaj: &str){ - - for (index,lines) in blahaj.lines().enumerate(){ - if index<=7{ - println!("{}",lines.truecolor(30,30,30)); - }else if index>6&&index<=12 { - println!("{}",lines.truecolor(255,0,0)); - }else { println!("{}", lines.truecolor(255,255,0)); } +fn german(blahaj: &str) { + for (index, lines) in blahaj.lines().enumerate() { + if index <= 7 { + println!("{}", lines.truecolor(30, 30, 30));//black + } else if index > 6 && index <= 12 { + println!("{}", lines.truecolor(255, 0, 0));//red + } else { + println!("{}", lines.truecolor(255, 255, 0));//yellow + } } - }