merged in flags and features from main
This commit is contained in:
commit
d6370da9e2
7 changed files with 45 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "pride"
|
name = "pride"
|
||||||
version = "0.1.4"
|
version = "0.2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
10
README.md
10
README.md
|
@ -3,16 +3,12 @@
|
||||||
|
|
||||||
A Rust utility to display pride flags in the terminal.
|
A Rust utility to display pride flags in the terminal.
|
||||||
|
|
||||||
**This project is under heavy construction! It is subject to major structural and
|
A list of currently implemented flags is available on the [project wiki](https://git.vwolfe.io/valerie/pride/wiki/Flags).
|
||||||
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
|
## Dependencies
|
||||||
|
|
||||||
Complex renderers often use [Powerline's slant](https://github.com/ryanoasis/powerline-extra-symbols)
|
Some Complex renderers utilize [Powerline's](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).
|
slant symbols, and therefore require use of a Powerline font, such as [Fira Code](https://github.com/tonsky/FiraCode).
|
||||||
|
|
||||||
## Libraries
|
## Libraries
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ pub static RESET_BG: Bg<Reset> = Bg(Reset);
|
||||||
|
|
||||||
/// produces a termion foreground color from the provided integer
|
/// produces a termion foreground color from the provided integer
|
||||||
pub fn rgb(hex: u32) -> Color {
|
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();
|
let [_, r, g, b] = hex.to_be_bytes();
|
||||||
|
|
||||||
Fg(Rgb(r, g, b))
|
Fg(Rgb(r, g, b))
|
||||||
|
|
|
@ -54,10 +54,12 @@ pub fn fg_stripes(colors: Vec<Fg<Rgb>>, width: u16, height: u16) -> Vec<String>
|
||||||
let stripe = BLOCK.repeat(width);
|
let stripe = BLOCK.repeat(width);
|
||||||
let mut output = Vec::new();
|
let mut output = Vec::new();
|
||||||
|
|
||||||
|
// create our color index
|
||||||
let mut index = 0;
|
let mut index = 0;
|
||||||
for n in 0..height {
|
for n in 0..height {
|
||||||
if n != 0 && n % thresh == 0 {
|
if n != 0 && n % thresh == 0 {
|
||||||
index += 1;
|
index += 1;
|
||||||
|
// and break if out of bounds
|
||||||
if index >= count { break; }
|
if index >= count { break; }
|
||||||
}
|
}
|
||||||
let color = colors[index];
|
let color = colors[index];
|
||||||
|
|
21
src/flag.rs
21
src/flag.rs
|
@ -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::*;
|
use crate::color::*;
|
||||||
|
|
||||||
|
@ -66,6 +68,17 @@ pub fn bisexual() -> Flag {
|
||||||
Flag::Stripes(vec![magenta, magenta, purple, blue, blue])
|
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 {
|
pub fn genderfluid() -> Flag {
|
||||||
let pink = rgb(0xFF75A2);
|
let pink = rgb(0xFF75A2);
|
||||||
let violet = rgb(0xBE18D6);
|
let violet = rgb(0xBE18D6);
|
||||||
|
@ -74,6 +87,14 @@ pub fn genderfluid() -> Flag {
|
||||||
Flag::Stripes(vec![pink, WHITE, violet, BLACK, blue])
|
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 {
|
pub fn genderqueer() -> Flag {
|
||||||
let purple = rgb(0xB899DF);
|
let purple = rgb(0xB899DF);
|
||||||
let green = rgb(0x6B8E3B);
|
let green = rgb(0x6B8E3B);
|
||||||
|
|
18
src/main.rs
18
src/main.rs
|
@ -14,6 +14,7 @@ use crate::flag::Flag;
|
||||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// collect args
|
||||||
let mut args = Arguments::from_env();
|
let mut args = Arguments::from_env();
|
||||||
|
|
||||||
// handle help flag
|
// handle help flag
|
||||||
|
@ -39,8 +40,10 @@ fn main() {
|
||||||
|
|
||||||
let subcommand = args.subcommand().unwrap();
|
let subcommand = args.subcommand().unwrap();
|
||||||
|
|
||||||
|
// get color vec from matched flag
|
||||||
let flag: Flag = match subcommand.as_deref() {
|
let flag: Flag = match subcommand.as_deref() {
|
||||||
Some("pride" | "gay")
|
Some("pride" | "rainbow")
|
||||||
|
| None
|
||||||
=> {
|
=> {
|
||||||
let variant = args.subcommand().unwrap_or(None);
|
let variant = args.subcommand().unwrap_or(None);
|
||||||
match variant.as_deref() {
|
match variant.as_deref() {
|
||||||
|
@ -86,9 +89,15 @@ fn main() {
|
||||||
// Some("disability")
|
// Some("disability")
|
||||||
// => complex::disability();
|
// => complex::disability();
|
||||||
|
|
||||||
|
Some("gay" | "mlm")
|
||||||
|
=> flag::gay(),
|
||||||
|
|
||||||
Some("genderfluid")
|
Some("genderfluid")
|
||||||
=> flag::genderfluid(),
|
=> flag::genderfluid(),
|
||||||
|
|
||||||
|
Some("gender-nonconforming" | "gnc" | "gendernonconforming")
|
||||||
|
=> flag::gender_nonconforming(),
|
||||||
|
|
||||||
Some("genderqueer")
|
Some("genderqueer")
|
||||||
=> flag::genderqueer(),
|
=> flag::genderqueer(),
|
||||||
|
|
||||||
|
@ -125,7 +134,7 @@ fn help_text() {
|
||||||
println!("Valerie Wolfe <sleeplessval@gmail.com>");
|
println!("Valerie Wolfe <sleeplessval@gmail.com>");
|
||||||
println!("Show pride flags in the terminal.\n");
|
println!("Show pride flags in the terminal.\n");
|
||||||
|
|
||||||
println!("usage: pride [flags] <name>\n");
|
println!("usage: pride [flags] [name]\n");
|
||||||
|
|
||||||
println!("args:");
|
println!("args:");
|
||||||
println!(" <name> The pride flag to display\n");
|
println!(" <name> The pride flag to display\n");
|
||||||
|
@ -152,8 +161,9 @@ fn list_text() {
|
||||||
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!(" disability disability pride flag");
|
||||||
println!(" gay, pride six-color rainbow flag");
|
println!(" gay, mlm gay men pride flag");
|
||||||
println!(" genderfluid genderfluid pride flag");
|
println!(" genderfluid genderfluid pride flag");
|
||||||
|
println!(" gender-nonconforming gender nonconforming pride flag");
|
||||||
println!(" genderqueer genderqueer pride flag");
|
println!(" genderqueer genderqueer pride flag");
|
||||||
println!(" gendervoid gendervoid pride flag");
|
println!(" gendervoid gendervoid pride flag");
|
||||||
// println!(" intersex intersex pride flag");
|
// println!(" intersex intersex pride flag");
|
||||||
|
@ -162,6 +172,8 @@ fn list_text() {
|
||||||
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!(" poly, polyamorous polyamorous 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");
|
println!(" trans, transgender transgender pride flag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! variant pride flags
|
||||||
|
//! these aren't in the flag module for organizational reasons.
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
color::*,
|
color::*,
|
||||||
|
|
Loading…
Reference in a new issue