updated variant code for new project structure
This commit is contained in:
parent
95bb8e9d60
commit
18af36ddeb
3 changed files with 39 additions and 52 deletions
43
src/flag.rs
43
src/flag.rs
|
@ -116,46 +116,3 @@ pub fn pansexual() -> Colors {
|
|||
vec![magenta, yellow, cyan]
|
||||
}
|
||||
|
||||
// misc variants
|
||||
|
||||
pub fn gilbert(small: bool) {
|
||||
let pink = color::Fg(color::Rgb(0xFF, 0x69, 0xB4));
|
||||
let red = color::Fg(color::Rgb(0xE5, 0x00, 0x00));
|
||||
let orange = color::Fg(color::Rgb(0xFF, 0x8D, 0x00));
|
||||
let yellow = color::Fg(color::Rgb(0xFF, 0xEE, 0x00));
|
||||
let green = color::Fg(color::Rgb(0x02, 0x81, 0x21));
|
||||
let cyan = color::Fg(color::Rgb(0x00, 0xC0, 0xC0));
|
||||
let blue = color::Fg(color::Rgb(0x00, 0x4C, 0xFF));
|
||||
let purple = color::Fg(color::Rgb(0x77, 0x00, 0x88));
|
||||
|
||||
if small {
|
||||
let width = 24;
|
||||
|
||||
println!(
|
||||
"{pink}{stripe}\n{red}{stripe}\n{orange}{stripe}\n{yellow}{stripe}\n{green}{stripe}\n{cyan}{stripe}\n{blue}{stripe}\n{purple}{stripe}{reset}",
|
||||
reset = color::Fg(color::Reset),
|
||||
stripe = BLOCK.repeat(24)
|
||||
);
|
||||
} else { draw(&[pink, red, orange, yellow, green, cyan, blue, purple]); }
|
||||
}
|
||||
|
||||
pub fn philadelphia(small: bool) {
|
||||
let black = color::Fg(color::Rgb(0x00, 0x00, 0x00));
|
||||
let brown = color::Fg(color::Rgb(0x78, 0x4F, 0x17));
|
||||
let red = color::Fg(color::Rgb(0xE5, 0x00, 0x00));
|
||||
let orange = color::Fg(color::Rgb(0xFF, 0x8D, 0x00));
|
||||
let yellow = color::Fg(color::Rgb(0xFF, 0xEE, 0x00));
|
||||
let green = color::Fg(color::Rgb(0x02, 0x81, 0x21));
|
||||
let blue = color::Fg(color::Rgb(0x00, 0x4C, 0xFF));
|
||||
let purple = color::Fg(color::Rgb(0x77, 0x00, 0x88));
|
||||
|
||||
if small {
|
||||
let width = 24;
|
||||
|
||||
println!(
|
||||
"{black}{stripe}\n{brown}{stripe}\n{red}{stripe}\n{orange}{stripe}\n{yellow}{stripe}\n{green}{stripe}\n{blue}{stripe}\n{purple}{stripe}{reset}",
|
||||
reset = color::Fg(color::Reset),
|
||||
stripe = BLOCK.repeat(width)
|
||||
);
|
||||
} else { draw(&[black, brown, red, orange, yellow, green, blue, purple]); }
|
||||
}
|
||||
|
|
21
src/main.rs
21
src/main.rs
|
@ -5,6 +5,7 @@ use pico_args::Arguments;
|
|||
mod color;
|
||||
mod draw;
|
||||
mod flag;
|
||||
mod variant;
|
||||
|
||||
use crate::color::Colors;
|
||||
|
||||
|
@ -38,7 +39,17 @@ fn main() {
|
|||
|
||||
let colors: Colors = match subcommand.as_deref() {
|
||||
Some("pride" | "gay")
|
||||
=> flag::pride(),
|
||||
=> {
|
||||
let variant = args.subcommand().unwrap_or(None);
|
||||
match variant.as_deref() {
|
||||
Some("8-color" | "gilbert-baker" | "sex-and-magic")
|
||||
=> variant::gilbert_baker(),
|
||||
Some("philadelphia")
|
||||
=> variant::philadelphia(),
|
||||
_
|
||||
=> flag::pride()
|
||||
}
|
||||
},
|
||||
|
||||
Some("transgender" | "trans")
|
||||
=> flag::transgender(),
|
||||
|
@ -80,14 +91,6 @@ fn main() {
|
|||
Some("pansexual" | "pan")
|
||||
=> flag::pansexual(),
|
||||
|
||||
|
||||
Some("sex-and-magic")|
|
||||
Some("baker") |
|
||||
Some("gilbert") => flag::gilbert(small),
|
||||
|
||||
Some("philly") |
|
||||
Some("philadelphia")=> flag::philadelphia(small),
|
||||
|
||||
_ => { help_text(); exit(1) }
|
||||
};
|
||||
|
||||
|
|
27
src/variant.rs
Normal file
27
src/variant.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
|
||||
use crate::{
|
||||
color::*,
|
||||
flag
|
||||
};
|
||||
|
||||
pub fn gilbert_baker() -> Colors {
|
||||
let pink = rgb(0xFF69B4); // sex
|
||||
let cyan = rgb(0x00C0C0); // magic
|
||||
|
||||
let mut output = flag::pride();
|
||||
output.insert(0, pink);
|
||||
output.insert(5, cyan);
|
||||
|
||||
output
|
||||
}
|
||||
|
||||
pub fn philadelphia() -> Colors {
|
||||
let brown = rgb(0x784F17);
|
||||
|
||||
let mut output = flag::pride();
|
||||
output.insert(0, BLACK);
|
||||
output.insert(1, brown);
|
||||
|
||||
output
|
||||
}
|
||||
|
Loading…
Reference in a new issue