Compare commits
No commits in common. "d6370da9e2d66d43cf68c4d629a1fb41ec91d2f7" and "b238dbeecb72130cd193868028b84087ec09bc11" have entirely different histories.
d6370da9e2
...
b238dbeecb
7 changed files with 11 additions and 45 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "pride"
|
||||
version = "0.2.0"
|
||||
version = "0.1.4"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
10
README.md
10
README.md
|
@ -3,12 +3,16 @@
|
|||
|
||||
A Rust utility to display pride flags in the terminal.
|
||||
|
||||
A list of currently implemented flags is available on the [project wiki](https://git.vwolfe.io/valerie/pride/wiki/Flags).
|
||||
**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.
|
||||
|
||||
## Dependencies
|
||||
|
||||
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).
|
||||
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
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ 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))
|
||||
|
|
|
@ -54,12 +54,10 @@ 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];
|
||||
|
|
21
src/flag.rs
21
src/flag.rs
|
@ -1,5 +1,3 @@
|
|||
//! stripe pride flag color functions.
|
||||
//! all of these return a Vec of colors to be drawn from first to last.
|
||||
|
||||
use crate::color::*;
|
||||
|
||||
|
@ -68,17 +66,6 @@ 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);
|
||||
|
@ -87,14 +74,6 @@ 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);
|
||||
|
|
18
src/main.rs
18
src/main.rs
|
@ -14,7 +14,6 @@ use crate::flag::Flag;
|
|||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
fn main() {
|
||||
// collect args
|
||||
let mut args = Arguments::from_env();
|
||||
|
||||
// handle help flag
|
||||
|
@ -40,10 +39,8 @@ fn main() {
|
|||
|
||||
let subcommand = args.subcommand().unwrap();
|
||||
|
||||
// get color vec from matched flag
|
||||
let flag: Flag = match subcommand.as_deref() {
|
||||
Some("pride" | "rainbow")
|
||||
| None
|
||||
Some("pride" | "gay")
|
||||
=> {
|
||||
let variant = args.subcommand().unwrap_or(None);
|
||||
match variant.as_deref() {
|
||||
|
@ -89,15 +86,9 @@ 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(),
|
||||
|
||||
|
@ -134,7 +125,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");
|
||||
|
@ -161,9 +152,8 @@ fn list_text() {
|
|||
println!(" demiromantic demiromantic pride flag");
|
||||
println!(" demisexual demisexual pride flag");
|
||||
// println!(" disability disability pride flag");
|
||||
println!(" gay, mlm gay men pride flag");
|
||||
println!(" gay, pride six-color rainbow 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");
|
||||
|
@ -172,8 +162,6 @@ 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");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
//! variant pride flags
|
||||
//! these aren't in the flag module for organizational reasons.
|
||||
|
||||
use crate::{
|
||||
color::*,
|
||||
|
|
Loading…
Reference in a new issue