Compare commits
No commits in common. "7f9a8aad97430e34abb4501cc56097e8ba8f59fa" and "d18b918b44b01903650bc1e172bd0056b2b2c7e7" have entirely different histories.
7f9a8aad97
...
d18b918b44
8 changed files with 5 additions and 83 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "pride"
|
||||
version = "0.2.3"
|
||||
version = "0.2.2"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
//! utility types and functions for color operations
|
||||
|
||||
use termion::color::{ Bg, Fg, Rgb, Reset };
|
||||
|
||||
|
|
|
@ -181,7 +181,6 @@ pub fn aroace(small: bool) -> Flag {
|
|||
Flag::Lines(lines)
|
||||
}
|
||||
|
||||
|
||||
fn demi_orientation_render(middle: Bg<Rgb>, bottom: Bg<Rgb>, width: u16, height: u16) -> Vec<String> {
|
||||
let white = bg(0xFFFFFF);
|
||||
|
||||
|
@ -239,7 +238,6 @@ pub fn demisexual(small: bool) -> Flag {
|
|||
Flag::Lines(lines)
|
||||
}
|
||||
|
||||
|
||||
pub fn disability() {
|
||||
let gray = bg(0x575757);
|
||||
|
||||
|
@ -255,7 +253,6 @@ pub fn disability() {
|
|||
|
||||
}
|
||||
|
||||
|
||||
pub fn intersex() -> Flag {
|
||||
let yellow = bg(0xFFDA00);
|
||||
let purple = rgb(0x7A00AC);
|
||||
|
@ -273,7 +270,6 @@ pub fn intersex() -> Flag {
|
|||
Flag::Lines(lines)
|
||||
}
|
||||
|
||||
|
||||
pub fn polyamory(small: bool) -> Flag {
|
||||
let blue = rgb(0x019FE3);
|
||||
let magenta = rgb(0xE50051);
|
||||
|
@ -293,9 +289,9 @@ pub fn polyamory(small: bool) -> Flag {
|
|||
|
||||
// constraints
|
||||
let linecount = height - (height % 3); // largest multiple of 3 smaller than height
|
||||
let full_depth = linecount;
|
||||
let full_depth = width / 3;
|
||||
let thresh = linecount / 3; // stripe & direction thresh
|
||||
let start = 2 * full_depth / 3;
|
||||
let start = width / 6;
|
||||
|
||||
// piecewise function: ascent -> descent
|
||||
let mut separator = separators[0];
|
||||
|
@ -317,7 +313,8 @@ pub fn polyamory(small: bool) -> Flag {
|
|||
// advance index at threshold
|
||||
if n == (thresh * 2) { index = 1; }
|
||||
|
||||
let size = (2 * start) - n - 1;
|
||||
let rel = (n - thresh) + 2;
|
||||
let size = full_depth - rel;
|
||||
let color = stripes[index];
|
||||
|
||||
let line = format!(
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
//! render handling code
|
||||
|
||||
use std::io::{ self, Write };
|
||||
|
||||
use termion::{
|
||||
|
@ -20,7 +18,6 @@ use crate::{
|
|||
pub static BLOCK: &str = "█";
|
||||
pub static UHALF: &str = "▀";
|
||||
|
||||
/// prints a provided vec of lines to stdout
|
||||
pub fn draw_lines(lines: Vec<String>, hold: bool) {
|
||||
let mut stdout = io::stdout().into_raw_mode().unwrap();
|
||||
|
||||
|
@ -47,7 +44,6 @@ pub fn draw_lines(lines: Vec<String>, hold: bool) {
|
|||
stdout.flush().ok();
|
||||
}
|
||||
|
||||
/// generates lines for foreground colors provided as a vec of strings for the draw_lines method
|
||||
pub fn fg_stripes(colors: Vec<Fg<Rgb>>, width: u16, height: u16) -> Vec<String> {
|
||||
let width = width as usize;
|
||||
let height = height as usize;
|
||||
|
@ -72,7 +68,6 @@ pub fn fg_stripes(colors: Vec<Fg<Rgb>>, width: u16, height: u16) -> Vec<String>
|
|||
|
||||
output
|
||||
}
|
||||
/// generates lines for background colors provided as a vec of strings for the draw_lines method
|
||||
pub fn bg_stripes(colors: Vec<Bg<Rgb>>, width: u16, height: u16) -> Vec<String> {
|
||||
let width = width as usize;
|
||||
let height = height as usize;
|
||||
|
@ -97,7 +92,6 @@ pub fn bg_stripes(colors: Vec<Bg<Rgb>>, width: u16, height: u16) -> Vec<String>
|
|||
}
|
||||
|
||||
impl Flag {
|
||||
/// renders a flag to stdout
|
||||
pub fn draw(self, hold: bool) {
|
||||
let lines = match self {
|
||||
Flag::Stripes(colors)
|
||||
|
|
47
src/flag.rs
47
src/flag.rs
|
@ -53,7 +53,6 @@ pub fn aroace() -> Flag {
|
|||
Flag::Stripes(vec![orange, yellow, WHITE, blue, navy])
|
||||
}
|
||||
|
||||
|
||||
pub fn bigender() -> Flag {
|
||||
let pink = rgb(0xE676A6);
|
||||
let yellow = rgb(0xF9F04C);
|
||||
|
@ -71,31 +70,6 @@ pub fn bisexual() -> Flag {
|
|||
Flag::Stripes(vec![magenta, magenta, purple, blue, blue])
|
||||
}
|
||||
|
||||
|
||||
fn demigender_base(color: Color) -> Colors {
|
||||
let grey = rgb(0x7F7F7F);
|
||||
let gray = rgb(0xC3C3C3);
|
||||
|
||||
|
||||
vec![grey, gray, color, WHITE, color, gray, grey]
|
||||
}
|
||||
|
||||
pub fn demiboy() -> Flag {
|
||||
let blue = rgb(0x7ACBF5);
|
||||
Flag::Stripes(demigender_base(blue))
|
||||
}
|
||||
|
||||
pub fn demigender() -> Flag {
|
||||
let yellow = rgb(0xFBFF74);
|
||||
Flag::Stripes(demigender_base(yellow))
|
||||
}
|
||||
|
||||
pub fn demigirl() -> Flag {
|
||||
let pink = rgb(0xEAACB8);
|
||||
Flag::Stripes(demigender_base(pink))
|
||||
}
|
||||
|
||||
|
||||
pub fn gay() -> Flag {
|
||||
let green1 = rgb(0x00906D);
|
||||
let green2 = rgb(0x00D1A7);
|
||||
|
@ -137,7 +111,6 @@ pub fn gendervoid() -> Flag {
|
|||
Flag::Stripes(vec![navy, gray, BLACK, gray, navy])
|
||||
}
|
||||
|
||||
|
||||
pub fn lesbian() -> Flag {
|
||||
let red = rgb(0xD62800);
|
||||
let orange = rgb(0xFF9B56);
|
||||
|
@ -147,7 +120,6 @@ pub fn lesbian() -> Flag {
|
|||
Flag::Stripes(vec![red, orange, WHITE, pink, magenta])
|
||||
}
|
||||
|
||||
|
||||
pub fn multigender() -> Flag {
|
||||
let blue = rgb(0x3F47CC);
|
||||
let ltblue = rgb(0x01A4E9);
|
||||
|
@ -156,15 +128,6 @@ pub fn multigender() -> Flag {
|
|||
Flag::Stripes(vec![blue, ltblue, orange, ltblue, blue])
|
||||
}
|
||||
|
||||
pub fn multisexual() -> Flag {
|
||||
let purple = rgb(0x724DC9);
|
||||
let blue = rgb(0xFF3D9B);
|
||||
let pink = rgb(0xFF3D9B);
|
||||
|
||||
Flag::Stripes(vec![purple, WHITE, blue, pink])
|
||||
}
|
||||
|
||||
|
||||
pub fn nonbinary() -> Flag {
|
||||
let yellow = rgb(0xFFF433);
|
||||
let purple = rgb(0x9B59D0);
|
||||
|
@ -172,7 +135,6 @@ pub fn nonbinary() -> Flag {
|
|||
Flag::Stripes(vec![yellow, WHITE, purple, BLACK])
|
||||
}
|
||||
|
||||
|
||||
pub fn pansexual() -> Flag {
|
||||
let magenta = rgb(0xFF1B8D);
|
||||
let yellow = rgb(0xFFDA00);
|
||||
|
@ -181,15 +143,6 @@ pub fn pansexual() -> Flag {
|
|||
Flag::Stripes(vec![magenta, yellow, cyan])
|
||||
}
|
||||
|
||||
pub fn polysexual() -> Flag {
|
||||
let pink = rgb(0xF61CB9);
|
||||
let green = rgb(0x07D569);
|
||||
let blue = rgb(0x1C92F6);
|
||||
|
||||
Flag::Stripes(vec![pink, green, blue])
|
||||
}
|
||||
|
||||
|
||||
pub fn transgender() -> Flag {
|
||||
let pink = rgb(0x7ACBF5);
|
||||
let blue = rgb(0xEAACB8);
|
||||
|
|
|
@ -32,9 +32,6 @@ flag list:
|
|||
asexual asexual pride flag
|
||||
bigender bigender pride flag
|
||||
bisexual bisexual pride flag
|
||||
demiboy demiboy pride flag
|
||||
demigender demigender pride flag
|
||||
demigirl demigirl pride flag
|
||||
demiromantic demiromantic pride flag
|
||||
demisexual demisexual pride flag
|
||||
gay gay men pride flag
|
||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -1,5 +1,3 @@
|
|||
//! main method module
|
||||
|
||||
use std::{
|
||||
io::{ stdout, IsTerminal },
|
||||
process::exit
|
||||
|
@ -100,14 +98,6 @@ fn main() {
|
|||
Some("bisexual" | "bi")
|
||||
=> flag::bisexual(),
|
||||
|
||||
|
||||
Some("demiboy")
|
||||
=> flag::demiboy(),
|
||||
Some("demigender")
|
||||
=> flag::demigender(),
|
||||
Some("demigirl")
|
||||
=> flag::demigirl(),
|
||||
|
||||
Some("demiromantic")
|
||||
=> complex::demiromantic(small),
|
||||
|
||||
|
@ -146,9 +136,6 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
Some("multisexual" | "m-spec" | "mspec")
|
||||
=> flag::multisexual(),
|
||||
|
||||
Some("multigender")
|
||||
=> flag::multigender(),
|
||||
|
||||
|
@ -161,9 +148,6 @@ fn main() {
|
|||
Some("polyamory" | "polyamorous" | "poly")
|
||||
=> complex::polyamory(small),
|
||||
|
||||
Some("polysexual")
|
||||
=> flag::polysexual(),
|
||||
|
||||
Some("transgender" | "trans")
|
||||
=> flag::transgender(),
|
||||
|
||||
|
@ -171,7 +155,6 @@ fn main() {
|
|||
_ => { help::help_text(); exit(1) }
|
||||
};
|
||||
|
||||
// draw flag
|
||||
flag.draw(!small);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
//! utility functions for working with ansi strings
|
||||
|
||||
/// gets the substring of displayed characters of an ANSI formatted string
|
||||
pub fn ansi_substr(source: &str, start: usize, end: usize) -> String {
|
||||
|
|
Loading…
Reference in a new issue