Compare commits
No commits in common. "2617c192275a2eb23e4035fa1b62b4aabb12e902" and "930e26a0375e13117780a39fca87b91b889db418" have entirely different histories.
2617c19227
...
930e26a037
3 changed files with 19 additions and 58 deletions
|
@ -12,6 +12,6 @@ slant symbols, and therefore require use of a Powerline font, such as [Fira Code
|
||||||
|
|
||||||
## Libraries
|
## Libraries
|
||||||
|
|
||||||
- [pico-args](https://crates.io/crates/pico-args) — argument parsing
|
- [pico-args](https://crates.io/crates/pico-args)
|
||||||
- [termion](https://crates.io/crates/termion) — ANSI formatting
|
- [termion](https://crates.io/crates/termion)
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,16 @@ pub fn progress(small: bool) -> Flag {
|
||||||
// set up stripe index
|
// set up stripe index
|
||||||
let mut index = 0;
|
let mut index = 0;
|
||||||
|
|
||||||
|
/* ok, coming up with procedure:
|
||||||
|
* - can't rely on bg_stripes; line count, threshold, etc., will need to happen here
|
||||||
|
* - line count will always be the largest multiple of 6 smaller than height; c = h - (h % 6)
|
||||||
|
* - chevrons may have larger widths: TODO calc
|
||||||
|
* - depth will be funky; line depth will need to use "full" depth; (Df - Dl) / Wc = Ic (TODO verify?)
|
||||||
|
* - switch stripe index on *absolute* line number rather than n
|
||||||
|
* - chevron building will be BLOCK.repeat(width) + TRIANGLE_21[0] (fg Ic, bg Ic + 1)
|
||||||
|
* - chevrons[len - 1] will need unique handling to draw stripes
|
||||||
|
*/
|
||||||
|
|
||||||
// set up constraints
|
// set up constraints
|
||||||
let linecount = height - (height % 6); // largest multiple of 6 smaller than height
|
let linecount = height - (height % 6); // largest multiple of 6 smaller than height
|
||||||
let full_depth = width / 3;
|
let full_depth = width / 3;
|
||||||
|
@ -270,62 +280,13 @@ pub fn intersex() -> Flag {
|
||||||
Flag::Lines(lines)
|
Flag::Lines(lines)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn polyamory(small: bool) -> Flag {
|
pub fn polyamorous() {
|
||||||
let blue = rgb(0x019FE3);
|
let blue = rgb(0x019FE3);
|
||||||
let magenta = rgb(0xE50051);
|
let magenta = rgb(0xE50051);
|
||||||
let purple = rgb(0x340C46);
|
let purple = rgb(0x340C46);
|
||||||
let yellow = rgb(0xFCBF00);
|
let yellow = rgb(0x00FCBF);
|
||||||
let white = bg(0xFFFFFF);
|
|
||||||
|
|
||||||
// special characters
|
// blue / magenta / purple vert
|
||||||
let semicircle = '\u{E0B6}';
|
// WHITE isosceles cutin with yellow heart pointed right
|
||||||
let separators = ['\u{E0BE}', '\u{E0BA}'];
|
|
||||||
|
|
||||||
let (width, height) = if small { (18, 6) } else { terminal_size().unwrap() };
|
|
||||||
|
|
||||||
// create stripe array and line buffer
|
|
||||||
let stripes = [magenta, purple]; // only stripes 2 and 3 need tracked
|
|
||||||
let mut lines: Vec<String> = Vec::new();
|
|
||||||
|
|
||||||
// constraints
|
|
||||||
let linecount = height - (height % 3); // largest multiple of 3 smaller than height
|
|
||||||
let full_depth = width / 3;
|
|
||||||
let thresh = linecount / 3; // stripe & direction thresh
|
|
||||||
let start = width / 6;
|
|
||||||
|
|
||||||
// piecewise function: ascent -> descent
|
|
||||||
let mut separator = separators[0];
|
|
||||||
for n in 0..thresh {
|
|
||||||
let size = start + n;
|
|
||||||
|
|
||||||
let line = format!(
|
|
||||||
"{white}{yellow}{cutin}{blue}{separator}{stripe}",
|
|
||||||
cutin = " ".repeat(size as usize),
|
|
||||||
stripe = draw::BLOCK.repeat((width - (size + 1)) as usize)
|
|
||||||
);
|
|
||||||
|
|
||||||
lines.push(line);
|
|
||||||
}
|
|
||||||
// first piece goes until the end of stripes[0]
|
|
||||||
let mut index = 0; // stripe index
|
|
||||||
separator = separators[1];
|
|
||||||
for n in thresh..linecount {
|
|
||||||
// advance index at threshold
|
|
||||||
if n == (thresh * 2) { index = 1; }
|
|
||||||
|
|
||||||
let rel = (n - thresh) + 2;
|
|
||||||
let size = full_depth - rel;
|
|
||||||
let color = stripes[index];
|
|
||||||
|
|
||||||
let line = format!(
|
|
||||||
"{white}{yellow}{cutin}{color}{separator}{stripe}",
|
|
||||||
cutin = " ".repeat(size as usize),
|
|
||||||
stripe = draw::BLOCK.repeat((width - (size + 1)) as usize)
|
|
||||||
);
|
|
||||||
|
|
||||||
lines.push(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
Flag::Lines(lines)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,8 +119,8 @@ fn main() {
|
||||||
Some("pansexual" | "pan")
|
Some("pansexual" | "pan")
|
||||||
=> flag::pansexual(),
|
=> flag::pansexual(),
|
||||||
|
|
||||||
Some("polyamory" | "polyamorous" | "poly")
|
// Some("poly" | "polyamorous" | "polyamory")
|
||||||
=> complex::polyamory(small),
|
// => complex::polyamorous(),
|
||||||
|
|
||||||
Some("progress")
|
Some("progress")
|
||||||
=> complex::progress(small),
|
=> complex::progress(small),
|
||||||
|
@ -174,7 +174,7 @@ fn list_text() {
|
||||||
println!(" multigender multigender pride flag");
|
println!(" multigender multigender pride flag");
|
||||||
println!(" nb, nonbinary nonbinary pride flag");
|
println!(" nb, nonbinary nonbinary pride flag");
|
||||||
println!(" pan, pansexual pansexual pride flag");
|
println!(" pan, pansexual pansexual pride flag");
|
||||||
println!(" polyamory polyamorous pride flag");
|
// println!(" poly, polyamorous polyamorous pride flag");
|
||||||
println!(" pride, rainbow six-color rainbow flag");
|
println!(" pride, rainbow six-color rainbow flag");
|
||||||
println!(" progress progress arrow flag");
|
println!(" progress progress arrow flag");
|
||||||
println!(" trans, transgender transgender pride flag");
|
println!(" trans, transgender transgender pride flag");
|
||||||
|
|
Loading…
Reference in a new issue