merged in flags and features from main

This commit is contained in:
Valerie Wolfe 2023-07-10 13:03:25 -04:00
commit d6370da9e2
7 changed files with 45 additions and 11 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "pride"
version = "0.1.4"
version = "0.2.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -3,16 +3,12 @@
A Rust utility to display pride flags in the terminal.
**This project is under heavy construction! It is subject to major structural and
architectural changes. There are no issues with functionality, but I will continue
to make major changes and refactors until the main roadmap is complete.**
Currently supports a variety of stripe flags.
A list of currently implemented flags is available on the [project wiki](https://git.vwolfe.io/valerie/pride/wiki/Flags).
## Dependencies
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).
Some Complex renderers utilize [Powerline's](https://github.com/ryanoasis/powerline-extra-symbols)
slant symbols, and therefore require use of a Powerline font, such as [Fira Code](https://github.com/tonsky/FiraCode).
## Libraries

View file

@ -12,6 +12,7 @@ pub static RESET_BG: Bg<Reset> = Bg(Reset);
/// produces a termion foreground color from the provided integer
pub fn rgb(hex: u32) -> Color {
// colors should be 0xrrggbb = 0x__rrggbb; drop the most significant byte
let [_, r, g, b] = hex.to_be_bytes();
Fg(Rgb(r, g, b))

View file

@ -54,10 +54,12 @@ pub fn fg_stripes(colors: Vec<Fg<Rgb>>, width: u16, height: u16) -> Vec<String>
let stripe = BLOCK.repeat(width);
let mut output = Vec::new();
// create our color index
let mut index = 0;
for n in 0..height {
if n != 0 && n % thresh == 0 {
index += 1;
// and break if out of bounds
if index >= count { break; }
}
let color = colors[index];

View file

@ -1,3 +1,5 @@
//! stripe pride flag color functions.
//! all of these return a Vec of colors to be drawn from first to last.
use crate::color::*;
@ -66,6 +68,17 @@ pub fn bisexual() -> Flag {
Flag::Stripes(vec![magenta, magenta, purple, blue, blue])
}
pub fn gay() -> Flag {
let green1 = rgb(0x00906D);
let green2 = rgb(0x00D1A7);
let green3 = rgb(0x7EEBC1);
let blue1 = rgb(0x6CAEE8);
let blue2 = rgb(0x5543D3);
let blue3 = rgb(0x461280);
Flag::Stripes(vec![green1, green2, green3, WHITE, blue1, blue2, blue3])
}
pub fn genderfluid() -> Flag {
let pink = rgb(0xFF75A2);
let violet = rgb(0xBE18D6);
@ -74,6 +87,14 @@ pub fn genderfluid() -> Flag {
Flag::Stripes(vec![pink, WHITE, violet, BLACK, blue])
}
pub fn gender_nonconforming() -> Flag {
let purple = rgb(0x50284D);
let magenta = rgb(0x96467B);
let blue = rgb(0x5C96F7);
Flag::Stripes(vec![purple, purple, magenta, blue, WHITE, blue, magenta, purple, purple])
}
pub fn genderqueer() -> Flag {
let purple = rgb(0xB899DF);
let green = rgb(0x6B8E3B);

View file

@ -14,6 +14,7 @@ use crate::flag::Flag;
static VERSION: &str = env!("CARGO_PKG_VERSION");
fn main() {
// collect args
let mut args = Arguments::from_env();
// handle help flag
@ -39,8 +40,10 @@ fn main() {
let subcommand = args.subcommand().unwrap();
// get color vec from matched flag
let flag: Flag = match subcommand.as_deref() {
Some("pride" | "gay")
Some("pride" | "rainbow")
| None
=> {
let variant = args.subcommand().unwrap_or(None);
match variant.as_deref() {
@ -86,9 +89,15 @@ fn main() {
// Some("disability")
// => complex::disability();
Some("gay" | "mlm")
=> flag::gay(),
Some("genderfluid")
=> flag::genderfluid(),
Some("gender-nonconforming" | "gnc" | "gendernonconforming")
=> flag::gender_nonconforming(),
Some("genderqueer")
=> flag::genderqueer(),
@ -125,7 +134,7 @@ fn help_text() {
println!("Valerie Wolfe <sleeplessval@gmail.com>");
println!("Show pride flags in the terminal.\n");
println!("usage: pride [flags] <name>\n");
println!("usage: pride [flags] [name]\n");
println!("args:");
println!(" <name> The pride flag to display\n");
@ -152,8 +161,9 @@ fn list_text() {
println!(" demiromantic demiromantic pride flag");
println!(" demisexual demisexual pride flag");
// println!(" disability disability pride flag");
println!(" gay, pride six-color rainbow flag");
println!(" gay, mlm gay men pride flag");
println!(" genderfluid genderfluid pride flag");
println!(" gender-nonconforming gender nonconforming pride flag");
println!(" genderqueer genderqueer pride flag");
println!(" gendervoid gendervoid pride flag");
// println!(" intersex intersex pride flag");
@ -162,6 +172,8 @@ fn list_text() {
println!(" nb, nonbinary nonbinary pride flag");
println!(" pan, pansexual pansexual pride flag");
// println!(" poly, polyamorous polyamorous pride flag");
println!(" pride, rainbow six-color rainbow flag");
println!(" progress progress arrow flag");
println!(" trans, transgender transgender pride flag");
}

View file

@ -1,3 +1,5 @@
//! variant pride flags
//! these aren't in the flag module for organizational reasons.
use crate::{
color::*,