Compare commits

...

2 commits

5 changed files with 102 additions and 18 deletions

View file

@ -9,6 +9,13 @@ to make major changes and refactors until the main roadmap is complete.**
Currently supports a variety of stripe flags. Currently supports a variety of stripe flags.
Under Construction features: ## Dependencies
- ["Complex" Flags](https://git.vwolfe.io/valerie/pride/src/branch/complex)
Complex renderers often use [Powerline's slant](https://github.com/ryanoasis/powerline-extra-symbols)
symbols, and therefore require use of a Powerline font, such as [Fira Code](https://github.com/tonsky/FiraCode).
## Libraries
- [pico-args](https://crates.io/crates/pico-args)
- [termion](https://crates.io/crates/termion)

View file

@ -1,5 +1,5 @@
use termion::color::{ Fg, Rgb, Reset }; use termion::color::{ Bg, Fg, Rgb, Reset };
pub type Color = Fg<Rgb>; pub type Color = Fg<Rgb>;
pub type Colors = Vec<Fg<Rgb>>; pub type Colors = Vec<Fg<Rgb>>;
@ -8,10 +8,19 @@ pub static BLACK: Color = Fg(Rgb(0x00, 0x00, 0x00));
pub static WHITE: Color = Fg(Rgb(0xFF, 0xFF, 0xFF)); pub static WHITE: Color = Fg(Rgb(0xFF, 0xFF, 0xFF));
pub static RESET: Fg<Reset> = Fg(Reset); pub static RESET: Fg<Reset> = Fg(Reset);
pub static RESET_BG: Bg<Reset> = Bg(Reset);
/// produces a termion foreground color from the provided integer
pub fn rgb(hex: u32) -> Color { pub fn rgb(hex: u32) -> Color {
let [_, r, g, b] = hex.to_be_bytes(); let [_, r, g, b] = hex.to_be_bytes();
Fg(Rgb(r, g, b)) Fg(Rgb(r, g, b))
} }
/// produces a termion background color from the provided integer
pub fn bg(hex: u32) -> Bg<Rgb> {
let [_, r, g, b] = hex.to_be_bytes();
Bg(Rgb(r, g, b))
}

View file

@ -5,11 +5,32 @@ use crate::draw;
use crate::flag; use crate::flag;
use crate::variant; use crate::variant;
pub fn progress() { /// vertically stacking eighths
let philadelphia = variant::philadelphia(); pub static V_EIGHTH: [char; 7] = ['▁', '▂', '▃', '▄', '▅', '▆', '▇'];
let trans = flag::transgender(); /// horizontally stacking eighths
pub static H_EIGHTH: [char; 7] = ['▏', '▎', '▍', '▌', '▋', '▊', '▉'];
/// shading by intensity
pub static SHADING: [char; 3] = ['░', '▒', '▓'];
/// 2/3 slope slant
pub static SLANT_23: [char; 2] = ['🭒', '🭏'];
pub fn progress() -> Colors {
let red = bg(0xE50000);
let orange = bg(0xFF8D00);
let yellow = bg(0xFFEE00);
let green = bg(0x028121);
let blue = bg(0x004CFF);
let purple = bg(0x770088);
// we need these colors in both fg & bg; just hold the integers for now
let black: u16 = 0;
let brown: u16 = 0x784F17;
let pink: u16 = 0xEAACB8;
let white: u16 = 0xFFFFFF;
exit(0);
} }
// everything below this point is in alphabetical order // everything below this point is in alphabetical order
@ -36,18 +57,35 @@ pub fn demisexual() {
// BLACK triangle cutin // BLACK triangle cutin
} }
pub fn disability() {
let gray = bg(0x575757);
let green = rgb(0x3AAD7D);
let blue = rgb(0x79BFE0);
let white = rgb(0xE8E8E8);
let yellow = rgb(0xEDDB76);
let red = rgb(0xCD7281);
let stripe = [red, yellow, white, blue, green];
// 2/3 slant stripes with gray background
}
pub fn intersex() -> Colors { pub fn intersex() -> Colors {
let yellow = rgb(0xFFDA00); let yellow = bg(0xFFDA00);
let purple = rgb(0x7A00AC); let purple = rgb(0x7A00AC);
let stripe = draw::BLOCK.repeat(9); let block = " ";
let part = draw::BLOCK.repeat(4); let stripe = block.repeat(9);
let part = block.repeat(4);
println!( let lines = vec![
"{yellow}{stripe}\n{part}{purple}{}O{}{yellow}{part}\n{stripe}{RESET}", format!("{yellow}{stripe}"),
yellow.0.bg_string(), format!("{part}{purple}O{part}"),
RESET.0.bg_str() format!("{stripe}")
); ];
draw::lines(lines, false);
exit(0); exit(0);
} }

View file

@ -9,7 +9,7 @@ use termion::{
raw::IntoRawMode raw::IntoRawMode
}; };
use crate::color::{ RESET, Colors }; use crate::color::{ RESET, RESET_BG, Colors };
pub static BLOCK: &str = ""; pub static BLOCK: &str = "";
pub static UHALF: &str = ""; pub static UHALF: &str = "";
@ -61,3 +61,29 @@ pub fn small(colors: Colors) {
stdout.flush().ok(); stdout.flush().ok();
} }
pub fn lines(lines: Vec<String>, hold: bool) {
let mut stdout = io::stdout().into_raw_mode().unwrap();
let count = lines.len() as u16;
for _ in 0..count { write!(stdout, "\n").ok(); }
write!(stdout, "{}", cursor::Up(count)).ok();
if hold { write!(stdout, "{}{}", cursor::Hide, clear::All).ok(); }
let down = cursor::Down(1);
for line in lines {
let left = cursor::Left(line.len() as u16);
write!(stdout, "{line}{left}{down}").ok();
}
write!(stdout, "{RESET}{RESET_BG}").ok();
stdout.flush().ok();
if hold {
let stdin = io::stdin();
for _ in stdin.keys() { break; }
write!(stdout, "{}", clear::All).ok();
}
write!(stdout, "{}", cursor::Show).ok();
stdout.flush().ok();
}

View file

@ -77,10 +77,13 @@ fn main() {
=> flag::bisexual(), => flag::bisexual(),
// Some("demiromantic") // Some("demiromantic")
// => flag::demiromantic(), // => complex::demiromantic(),
// Some("demisexual") // Some("demisexual")
// => flag::demisexual(), // => complex::demisexual(),
// Some("disability")
// => complex::disability();
Some("genderfluid") Some("genderfluid")
=> flag::genderfluid(), => flag::genderfluid(),
@ -148,6 +151,7 @@ fn list_text() {
println!(" bi, bisexual bisexual pride flag"); println!(" bi, bisexual bisexual pride flag");
// println!(" demiromantic demiromantic pride flag"); // println!(" demiromantic demiromantic pride flag");
// println!(" demisexual demisexual pride flag"); // println!(" demisexual demisexual pride flag");
// println!(" disability disability pride flag");
println!(" gay, pride six-color rainbow flag"); println!(" gay, pride six-color rainbow flag");
println!(" genderfluid genderfluid pride flag"); println!(" genderfluid genderfluid pride flag");
println!(" genderqueer genderqueer pride flag"); println!(" genderqueer genderqueer pride flag");